Closed Bug 531804 Opened 16 years ago Closed 16 years ago

Jetpack API does not work inside document context

Categories

(Mozilla Labs :: Jetpack Prototype, defect, P3)

x86
All
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: zbraniecki, Assigned: avarma)

References

Details

Currently, Jetpack uses raw jQuery for it's API and jQuery's API is not ready to work with multiple contexts in most cases. Many selector functions like $(elem,jetpack.tabs.focused.contentDocument).is('#dialog') will not work because they ignore the context. Problems: 1) $('expr', context) is always converted into $(context).find('expr') which carries performance cost. http://github.com/jquery/jquery/blob/master/src/core.js#L121 2) Majority of http://docs.jquery.com/Traversing like .is, .filter, .add etc. are context unaware.
@ Atul I am wondering if this is related to my initial concerns regarding the expectations most library scripts have regarding a window context. Even jQuery is even bound to a window in a variety of cases (from reading the code) and I wonder if a Shadow DOM implementation negates this worry... This concern is a big one going forward, we need to have a complete strategy for minimizing this to the furthest extent possible.
Assignee: nobody → avarma
Priority: -- → P3
Blocks: 527294
with (jetpack.contexts.browser) {} with (jetpack.contexts.document) {} would be sweet
I am not sure if something like this will help: http://plugins.jquery.com/project/jquery_apply
(In reply to comment #0) > Currently, Jetpack uses raw jQuery for it's API Does it? You mean that the internals of jetpack are written using jQuery? Sorry, for ranting (it won't happen again on this bug), but is it wise? Shouldn't jQuery be just a syntactic sugar for newbies, and wouldn't be preferable (in terms of speed and reliability) jetpack itself was written in plain Javascript? I have now here two substantial jetpacks (1487 and 244 lines by wc -l) and my experience is that jQuery is nothing more than pain and suffering and jumping around rough edges and painful contacts with some weird compatibility hacks. Especially with querySelector* methods now, advantages of jQuery seem to be less and less obvious to me for the basic work (maybe animations are good, not sure, I don't use them). </rant> Howgh, now back to our regularly scheduled bug.
We will be monitoring all these issues after the rebooted Jetpack code base is released in the first week of March to ensure their causes are not duplicated. Many of the bugs/issues with the prototype version of Jetpack will be made irrelevant given the structure of the new SDK.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.