Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#6534 closed bug (invalid)

"doc.createDocumentFragment is not a function" error in 1.4+ when appending a function like so

Reported by: seasoup Owned by:
Priority: Milestone: 1.4.3
Component: core Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

This throws an error in 1.4 and 1.4.2 but not in 1.3.2. Didn't test 1.4.1

Test Case: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script>

var Dialog = function() {

$('body').append(this.loadingDialog);

};

Dialog.prototype = {

'loadingDialog': function () { return 'foo' }

};

var car = new Dialog();

</script></head><body></body></html>

The above code results in doc being a Window object below

fragment = doc.createDocumentFragment(); line 4373

which breaks it. Putting the following in front of it seems to fix it, but I don't know all the repercussions.

if (doc.constructor === Window) {

doc = document;

}

Wrapping

var car = new Dialog();

in a $(function () {} fixes it too.

Change History (2)

comment:1 Changed 7 years ago by dmethvin

  • Resolution set to invalid
  • Status changed from new to closed

The new Dialog() constructor happens outside a .ready() handler. jQuery doesn't guarantee it's ready until then. Perhaps it worked in 1.3 but it wasn't guaranteed.

comment:2 Changed 5 years ago by arisnordico@…

Hi frined do you find the awnser to this problem? cause I have the same problem :s

Note: See TracTickets for help on using tickets.