Skip to main content

Bug Tracker

Side navigation

#6534 closed bug (invalid)

Opened May 05, 2010 11:31PM UTC

Closed May 06, 2010 12:02AM UTC

Last modified March 15, 2012 01:20PM UTC

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

Attachments (0)
Change History (2)

Changed May 06, 2010 12:02AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

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.

Changed November 09, 2011 02:09PM UTC by arisnordico@gmail.com comment:2

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