Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#17373 closed Bug (fixed)

jQuery forward compatibility: TabularInline with extra = 0: "Add another" wraps in <div> instead of <tr> inside of <table>

Reported by: James Pic Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

To reproduce the bug, set extra = 0 in a TabularInline. Then open the admin page with the inline table, the "Add another" link is in a tr/td inside the table. Click "Add another" and it will add a row and wrap the "Add another" link inside a <div> instead of tr/td.

It is semantically wrong (a <div> may not have <table> for parent) and displays wrong ("Add another X" shouldn't wordwrap).

To fix the bug, change in https://code.djangoproject.com/browser/django/trunk/django/contrib/admin/static/admin/js/inlines.js#L44:

$(this).attr("tagName") == "TR"

Into:

$(this).is('tr')

FTR is there a better way than this command to enable non-compressed admin js ?

ln -Lfn ../env/lib/python2.7/site-packages/django/contrib/admin/media/js/inlines.js static/admin/js/inlines.min.js

Change History (5)

comment:1 by Bas Peschier, 13 years ago

Resolution: needsinfo
Status: newclosed

Can you provide more information about how to reproduce the bug?

I tested it with 1.3.1 and trunk and cannot reproduce it: it adds the correct rows/cells and does not word-wrap.

comment:2 by James Pic, 13 years ago

I'm using jQuery 1.6.2 and that's probably part of the problem. I don't know what's Django's politics about jQuery version but the proposed change should be both forward and backward compatible.

comment:3 by James Pic, 13 years ago

Resolution: needsinfo
Status: closedreopened
Summary: TabularInline with extra = 0: "Add another" wraps in <div> instead of <tr> inside of <table>jQuery forward compatibility: TabularInline with extra = 0: "Add another" wraps in <div> instead of <tr> inside of <table>

comment:4 by Aymeric Augustin, 13 years ago

Resolution: fixed
Status: reopenedclosed

r16967 should isolate Django's version of jQuery (used by the admin) from any other version (one you would load in a custom template).

So I believe this bug is fixed in trunk (or 1.4 alpha). Please reopen if it still occurs.

comment:5 by anonymous, 13 years ago

"jQuery version being isolated" is indeed an excuse for "not improving the javascript shipped by Django" ?

But what's the reason ? No time ?

Note: See TracTickets for help on using tickets.
Back to Top