KawaiiBASIC / classilla

Automatically exported from code.google.com/p/classilla
0 stars 0 forks source link

Failed object to createDocumentFragment [jQuery] #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the vein of issue 118, now that jQuery can fully parse, it wants better
DOM compatibility than we have ever offered. The next thing we need to
implement is createDocumentFragment. Unlike that bug, however, this has
never worked, so we will make it work now.

Original issue reported on code.google.com by classi...@floodgap.com on 17 May 2010 at 11:23

GoogleCodeExporter commented 9 years ago
Actually, we do have it in nsIDOMDocument.idl, and this does work:

javascript:alert(window.document.createDocumentFragment()); // object 
DocumentFragment

So does

javascript:alert((undefined || window.document).createDocumentFragment())

This is important because the offending line in
https://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.js is

var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),

Either we're passing bad objects, or we can't figure out what document to ask to
create the fragment. This hits Twitter, the Register and quite a few other 
sites, so
we should still try to fix it.

Original comment by classi...@floodgap.com on 17 May 2010 at 11:56

GoogleCodeExporter commented 9 years ago
Venkman demonstrates on Twitter that this[0] is an HTMLDivElement, which is 
correct,
but it has no ownerDocument (and it itself does not implement 
createDocumentFragment,
because it is not a document).

Original comment by classi...@floodgap.com on 18 May 2010 at 12:03

GoogleCodeExporter commented 9 years ago
M211634 looks right up our alley. Let's implement that.

Original comment by classi...@floodgap.com on 18 May 2010 at 12:09

GoogleCodeExporter commented 9 years ago
M211440 isn't really a dependency but it looks like something we should support 
as well.

Original comment by classi...@floodgap.com on 18 May 2010 at 12:13

GoogleCodeExporter commented 9 years ago
... however, it only partially applies to a few elements in Clecko. It's not 
worth
debugging to find out why the other ones won't apply since we'll get it in 9.3.

Original comment by classi...@floodgap.com on 18 May 2010 at 12:28

GoogleCodeExporter commented 9 years ago
211634 made no difference. Upping to Critical, more sites seem affected than I 
thought.

Original comment by classi...@floodgap.com on 18 May 2010 at 4:11

GoogleCodeExporter commented 9 years ago
This was rather complicated to implement. It appears that elements made 
dynamically
were basically owned by no document at all, because they were being added to a 
new
node info manager that had no awareness of the document they descended from. 
Analysis
of Mozilla code shows this was a very early change, possibly around 1.4 or 1.5. 
I
implemented a new function based on 1.7's
nsHTMLFragmentContentSink::SetTargetDocument, which correctly makes (or uses) 
the
proper node info manager with the right document, and then used patches from 
1.7 to
hook it up to nsRange when the node is created.

Now jQuery appears to work 100% and so does Twitter (albeit very slowly).

Original comment by classi...@floodgap.com on 22 May 2010 at 4:43