Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#9560 closed bug (cantfix)

Null function getAttribute is invoked in acceptData()

Reported by: anonymous Owned by: Rick Waldron
Priority: blocker Milestone: 1.7
Component: manipulation Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:


Sorry for the cryptic summary, but this problem is hard to succinctly define. Basically, I'm getting an error inside of jQuery's acceptData method; the getAttribute function, which is null, is being invoked on an object (an HTMLObjectElement). This is ultimately triggered by my application's calling of 'remove' on an element. Here's the simplified call stack:

-> cleanData (in jquery-ui)
   -> triggerHandler('remove')
      -> trigger('remove', ...)
         -> var m = f._data(k, 'handle')
            -> return f.data(a, 'data', c, !0)
               -> if (!!acceptData(a))
                  -> a.getAttribute('classid') (getAttribute is null)

This error is occurring in IE 9. I have no idea what is causing getAttribute to be null on what looks like a DOM object. The object is an HTML "object" object that happens to be some embedded Flash created through SWFObject. Perhaps jQuery can add some defensive code so that if getAttribute is null, acceptData won't cause this error.

Change History (11)

comment:1 Changed 10 years ago by dmethvin

Owner: set to anonymous
Status: newpending

I can see how this might happen, an <object> tag is often a manifestation of a non-Javascript host object and doesn't play by the rules.

However, we could really use a test case, and can't work on a fix until we get one.

Also, the workaround will most likely be to ban use of .data() on the element so whatever code was trying to get/set data won't be able to do that. Alternatively we could allow use of .data() if we can determine it's safe to use for this particular case.

comment:2 Changed 10 years ago by davidalism

I had this exact problem in my application. My fix was that getAttribute was triggered from my jQuery draggable plugin, and so I just return if the element's tagname is object. This does not seem like something jQuery should fix, but it is the developer's responsibility to make sure that we call native JavaScript methods only on DOM elements that implement the methods.

comment:3 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 10 years ago by francesco.puglisi@…

update: using some templating libraries (I have tested this issue with David Pirek's JQuery MVC, http://www.davidpirek.com/javascript-mvc-jquery-plugin-framework), it is likely that the invocation of the .data() function doesn't fall directly under the developer's control. http://jsfiddle.net/airspeed/9TLZx/11/

comment:5 Changed 10 years ago by anonymous

I am seeing this issue a well. Occurs when you try to remove DOM element that contains Flash movie.

comment:6 Changed 10 years ago by Rick Waldron

Resolution: invalid
Status: closedreopened

comment:7 Changed 10 years ago by Rick Waldron

Component: unfiledmanipulation
Owner: changed from anonymous to Rick Waldron
Priority: undecidedlow
Status: reopenedassigned

Reopening for review

Last edited 10 years ago by Rick Waldron (previous) (diff)

comment:8 Changed 10 years ago by Rick Waldron

Milestone: 1.next1.7
Priority: lowblocker

comment:9 Changed 10 years ago by Rick Waldron

Resolution: cantfix
Status: assignedclosed

comment:10 Changed 8 years ago by anonymous

This is still an issue with 1.10.2 using uploadify. The uploadify object has a nodeName of 'OBJECT' and the jQuery noData function on it returns a classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000". However, the getAttribute function of the elem is null. It's simple enough to fix by just trapping for a null getAttribute function thus:

return (elem.getAttribute === true ? false : (!noData
noData !== true && elem.getAttribute("classid") === noData));

comment:11 Changed 8 years ago by dmethvin

Please report to the uploadify folks.

Note: See TracTickets for help on using tickets.