Download & Extend

jQuery :last-of-type pseudo-class not working anymore--maybe a FF3 thing?

Project:Drupal core
Version:5.16
Component:upload.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

I am not sure why this is broken now or why nobody has caught it until now, but I am guessing something outside Drupal changed recently. Maybe the browser upgrade from FF2 to FF3. At any rate, to reproduce simply try uploading more than one file to a node and on the second file you will get a JavaScript error and the "File attachments" fieldset will be left blank (e.g. no file uploads listed, where previously there was one because the first file you upload does work).

It becomes blank because the code calls $.empty() and then attempts to replace with XHTML markup passed via AJAX, but has an error along the way trying to use $() to select a DOM element.

The fix I found was to replace the :last-of-type CSS pseudo class with the safer equivalent of :last CSS pseudo class.

(see attached patch)

Although, strange thing, I just tried it with the d.o form and it's not breaking. Hmm... maybe there is another factor involved here. Will submit issue anyway and see if anyone else can confirm.

AttachmentSizeStatusTest resultOperations
upload.js_.last_of_type.patch841 bytesIgnored: Check issue status.NoneNone

Comments

#1

Status:needs review» postponed (maintainer needs more info)

This may be an issue with your theme or a module? Please try enabling one thing at a time on a test site.

#2

I had this same problem. On lines 77 and 90 of misc/upload.js, changing:

tr:last-of-type

to:

tr:last

solved the problem.

#3

Status:postponed (maintainer needs more info)» closed (won't fix)

Considering the lack of activity on this issue and that Drupal v5 is no longer supported by for fixes or patches, I am going to close this ticket.

nobody click here