[Django] #24406: SelectFilter should use click events instead of href javascript functions

4 views
Skip to first unread message

Django

unread,
Feb 24, 2015, 10:44:39 AM2/24/15
to django-...@googlegroups.com
#24406: SelectFilter should use click events instead of href javascript functions
-------------------------------------+-------------------------------------
Reporter: rjagerman | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Keywords: admin SelectFilter
| javascript
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
SelectFilter uses javascript in an href to handle button behavior:
{{{
<a href="javascript:function(){...}">
}}}

This is problematic if one wishes to customize the widget, since the href
javascript is executed after events are handled. It would be better to use
a click event to handle this type of behavior:
{{{
someElement.addEventListener("click", function() { ... } );
}}}

I have proposed a patch on github:

https://github.com/rjagerman/django/commit/e07a0be20d6da81794eaa5b64c2927cc6c70410d

--
Ticket URL: <https://code.djangoproject.com/ticket/24406>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 24, 2015, 10:58:53 AM2/24/15
to django-...@googlegroups.com
#24406: SelectFilter should use click events instead of href javascript functions
-------------------------------------+-------------------------------------
Reporter: rjagerman | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin SelectFilter | Triage Stage:
javascript | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by rjagerman):

* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0


Old description:

> SelectFilter uses javascript in an href to handle button behavior:
> {{{
> <a href="javascript:function(){...}">
> }}}
>
> This is problematic if one wishes to customize the widget, since the href
> javascript is executed after events are handled. It would be better to
> use a click event to handle this type of behavior:
> {{{
> someElement.addEventListener("click", function() { ... } );
> }}}
>
> I have proposed a patch on github:
>
> https://github.com/rjagerman/django/commit/e07a0be20d6da81794eaa5b64c2927cc6c70410d

New description:

SelectFilter uses javascript in an href to handle button behavior:
{{{
<a href="javascript:function(){...}">
}}}

This is problematic if one wishes to customize the widget, since the href
javascript is executed after events are handled. It would be better to use
a click event to handle this type of behavior:
{{{
someElement.addEventListener("click", function() { ... } );
}}}

I have proposed a patch on github:

https://github.com/rjagerman/django/tree/ticket_24406
https://github.com/rjagerman/django/commit/e07a0be20d6da81794eaa5b64c2927cc6c70410d

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24406#comment:1>

Django

unread,
Feb 24, 2015, 10:59:50 AM2/24/15
to django-...@googlegroups.com
#24406: SelectFilter should use click events instead of href javascript functions
-------------------------------------+-------------------------------------
Reporter: rjagerman | Owner: rjagerman
Type: | Status: assigned

Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin SelectFilter | Triage Stage:
javascript | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by rjagerman):

* owner: nobody => rjagerman
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24406#comment:2>

Django

unread,
Feb 24, 2015, 11:05:41 AM2/24/15
to django-...@googlegroups.com
#24406: SelectFilter should use click events instead of href javascript functions
-------------------------------------+-------------------------------------
Reporter: rjagerman | Owner: rjagerman
Type: | Status: assigned

Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin SelectFilter | Triage Stage:
javascript | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by rjagerman:

Old description:

> SelectFilter uses javascript in an href to handle button behavior:
> {{{
> <a href="javascript:function(){...}">
> }}}
>
> This is problematic if one wishes to customize the widget, since the href
> javascript is executed after events are handled. It would be better to
> use a click event to handle this type of behavior:
> {{{
> someElement.addEventListener("click", function() { ... } );
> }}}
>
> I have proposed a patch on github:
>

> https://github.com/rjagerman/django/tree/ticket_24406
> https://github.com/rjagerman/django/commit/e07a0be20d6da81794eaa5b64c2927cc6c70410d

New description:

SelectFilter uses javascript in an href to handle button behavior:
{{{
<a href="javascript:function(){...}">
}}}

This is problematic if one wishes to customize the widget, since the href
javascript is executed after events are handled. It would be better to use
a click event to handle this type of behavior:
{{{
someElement.addEventListener("click", function() { ... } );
}}}

I have proposed a patch on github:

https://github.com/django/django/pull/4205
https://github.com/rjagerman/django/tree/ticket_24406
https://github.com/rjagerman/django/commit/e07a0be20d6da81794eaa5b64c2927cc6c70410d

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24406#comment:3>

Django

unread,
Feb 26, 2015, 12:53:19 PM2/26/15
to django-...@googlegroups.com
#24406: SelectFilter should use click events instead of href javascript functions
-------------------------------------+-------------------------------------
Reporter: rjagerman | Owner: rjagerman
Type: | Status: closed

Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: admin SelectFilter | Triage Stage:
javascript | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"fa9cb5dcdc816fe0e606b8f1020d53526e08b0d4"]:
{{{
#!CommitTicketReference repository=""
revision="fa9cb5dcdc816fe0e606b8f1020d53526e08b0d4"
Fixed #24406 -- Improved SelectFilter js to use click events

The SelectFilter widget used href to execute javascript. This was


problematic if one wishes to customize the widget, since the href

javascript is executed after events are handled. This change modifies
the javascript to use click events to handle button behavior.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24406#comment:4>

Reply all
Reply to author
Forward
0 new messages