Skip to content

Commit 552bf1d

Browse files
committed
Determine head.firstChild at each new request. fixes jaubourg#1 (hopefully, given I've never been able to reproduce it). Version incremented to 2.3.1.
1 parent f9cf973 commit 552bf1d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/jquery.jsonp.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery JSONP Core Plugin 2.3.0 (2012-03-27)
2+
* jQuery JSONP Core Plugin 2.3.1 (2012-05-16)
33
*
44
* https://github.com/jaubourg/jquery-jsonp
55
*
@@ -60,8 +60,6 @@
6060
Deferred = $.Deferred,
6161
// Head element
6262
head = $( "head" )[ 0 ] || document.documentElement,
63-
// First child
64-
firstChild = head.firstChild,
6563
// Page cache
6664
pageCache = {},
6765
// Counter
@@ -123,6 +121,7 @@
123121
supportOnreadystatechange,
124122

125123
// Request execution vars
124+
firstChild,
126125
script,
127126
scriptAfter,
128127
timeoutTimer;
@@ -263,7 +262,7 @@
263262
};
264263

265264
// Append main script
266-
head[ STR_INSERT_BEFORE ]( script , firstChild );
265+
head[ STR_INSERT_BEFORE ]( script , ( firstChild = head.firstChild ) );
267266

268267
// Append trailing script if needed
269268
scriptAfter && head[ STR_INSERT_BEFORE ]( scriptAfter , firstChild );

0 commit comments

Comments
 (0)