Bug Tracker

Ticket #6534 (closed bug: invalid)

Opened 4 years ago

Last modified 2 years ago

"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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by dmethvin

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

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 3 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.