#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 , 13 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
comment:2 by , 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 , 13 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → reopened |
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 , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
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 , 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 ?
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.