Side navigation
#13844 closed bug (notabug)
Opened May 01, 2013 10:12AM UTC
Closed May 01, 2013 02:28PM UTC
FF throws "div.attributes[eventName] is undefined" at line 1446 in browser extension when jQuery.support is run (v1.9)
Reported by: | solasteoranta | Owned by: | solasteoranta |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Background
In a Firefox browser extension I built, users of FF v15 reported that nothing was working. When debugging, I noted a bunch of script errors beginning with the message referenced in the 'Summary' of this bug.
Reproducible Scenario
1. In FF15, navigate to https://builder.addons.mozilla.org/
2. Click Create an Add-on Now
3. If you don't have an account, you'll need to register here, otherwise, proceed to step 4.
4. Hover over 'Data' on the left-hand side and click the + sign that appears next to it.
5. Click Browse, find jquery-1.9.full.js, and click 'Create Attachment'
6. Repeat step 4 again
7. Where you see 'New Attachment name...', type index.html and click 'Create Attachment'
8. Open index.html and add the following code to it:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> </head> <body> </body> </html>
9. Under 'Lib', open main.js, and replace the existing code with the following:
// This is an active module of the atcaffrey Add-on var Request = require("sdk/request").Request; var data = require("sdk/self").data; exports.main = function() { var cs = '$("body").append( $("<div>If you can see this, jQuery is loading</div>") )'; var p = require("sdk/panel").Panel({ width:200, height:200, contentURL: data.url("index.html"), contentScript:cs, allow: {'script':true}, contentScriptFile: [ data.url("jquery-1.9.full.js") ] }); require("sdk/widget").Widget({ id: "merlin-widget-1", panel:p, label: "Test Add-On", contentURL: "http://www.mozilla.org/favicon.ico", onClick: function(event) { this.panel.show(); } }); };
10. Click the Save button
11. Click the Preview button (looks like an eye)
12. Install the Add-on Builder Helper if prompted, otherwise skip to next.
13. Add-on will appear as Firefox icon in Add-on toolbar at bottom right-hand corner of your screen. If you don't see the toolbar, use Ctrl + / to bring it up.
14. Click on the icon and press Ctrl+Shift+J to read the error message
Actual Results
jQuery does not load
''Timestamp: 30/04/2013 13:41:39
Error: app: An exception occurred.
TypeError: div.attributes[eventName] is undefined
resource://jid0-i8rrbz8bu5xwmi9wqap1ylablje-at-jetpack/app/data/jquery-1.9.full.js 1446
Traceback (most recent call last):
File "resource://jid0-i8rrbz8bu5xwmi9wqap1ylablje-at-jetpack/app/data/jquery-1.9.full.js", line 9611, in
})( window );
File "resource://jid0-i8rrbz8bu5xwmi9wqap1ylablje-at-jetpack/app/data/jquery-1.9.full.js", line 1307...''
Expected Results
jQuery loads. In this repro, you should be seeing a panel that contains the following test if successful: "If you can see this, jQuery is loading"
Workaround
I made the following change, and it's now working fine in my build:
for ( i in { submit: true, change: true, focusin: true }) { div.setAttribute( eventName = "on" + i, "t" ); var hasExpando=div.attributes[ eventName ] && div.attributes[ eventName ].expando; // Guard against undefined values, plug this into the assignment below: support[ i + "Bubbles" ] = eventName in window || (hasExpando && div.attributes[ eventName ].expando === false ? true : false); }
Requested Feedback
-Can we fix it?
-Is the workaround I mention above a scalable solution?
Attachments (0)
Change History (4)
Changed May 01, 2013 12:09PM UTC by comment:1
owner: | → solasteoranta |
---|---|
status: | new → pending |
Changed May 01, 2013 12:33PM UTC by comment:2
status: | pending → new |
---|
Thanks. I'll give that a bash and update.
Changed May 01, 2013 02:11PM UTC by comment:3
It's resolved in 2.0. Thanks.
When you say 1.x is not supported for "non-web scenarios such as browser extensions or platform-specific web apps", can you just confirm whether the intention is to support a wider range of platforms from 2.0? Would browser extensions be included? And will that be documented?
Thanks again.
Changed May 01, 2013 02:28PM UTC by comment:4
resolution: | → notabug |
---|---|
status: | new → closed |
See the blog post: http://blog.jquery.com/2013/04/18/jquery-2-0-released/
There is some more discussion in the older beta blog posts as well.
We're not supporting jQuery 1.9 (1.x in general) for non-web scenarios such as browser extensions or platform-specific web apps. Instead you should be using jQuery 2.0. Does 2.0 work?