diff options
author | Michał Gołębiowski <m.goleb@gmail.com> | 2016-03-02 12:28:00 +0100 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2016-03-02 12:34:06 +0100 |
commit | 6403cf614fc2db42517005e80eef7bc5b2223d01 (patch) | |
tree | b583c7618d069829f79c6720aeab72846316dbfc /src | |
parent | ed943872478a95403e20647b26c678bd153986ab (diff) | |
download | jquery-6403cf614fc2db42517005e80eef7bc5b2223d01.tar.gz jquery-6403cf614fc2db42517005e80eef7bc5b2223d01.zip |
Core: drop the document.implementation.createHTMLDocument usage
The document.implementation.createHTMLDocument("") method creates inert
documents which is good but using it has introduced issues around anchor
elements href property not resolving according to the current document.
Because of that, this patch is getting backed out on 1.x/2.x branches.
(cherry-picked from c5c30735311c74c60689fcabdcf2cb192524000e)
Refs cfe468f29c4cbe1a457d0feb17dec90dcfd7c280
Refs gh-1505
Fixes gh-2941
Diffstat (limited to 'src')
-rw-r--r-- | src/core/parseHTML.js | 14 | ||||
-rw-r--r-- | src/core/support.js | 21 |
2 files changed, 3 insertions, 32 deletions
diff --git a/src/core/parseHTML.js b/src/core/parseHTML.js index 55f67c43e..327d6ef5c 100644 --- a/src/core/parseHTML.js +++ b/src/core/parseHTML.js @@ -2,11 +2,8 @@ define( [ "../core", "../var/document", "./var/rsingleTag", - "../manipulation/buildFragment", - - // This is the only module that needs core/support - "./support" -], function( jQuery, document, rsingleTag, buildFragment, support ) { + "../manipulation/buildFragment" +], function( jQuery, document, rsingleTag, buildFragment ) { // data: string of html // context (optional): If specified, the fragment will be created in this context, @@ -20,12 +17,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) { keepScripts = context; context = false; } - - // document.implementation stops scripts or inline event handlers from - // being executed immediately - context = context || ( support.createHTMLDocument ? - document.implementation.createHTMLDocument( "" ) : - document ); + context = context || document; var parsed = rsingleTag.exec( data ), scripts = !keepScripts && []; diff --git a/src/core/support.js b/src/core/support.js deleted file mode 100644 index 36d19715f..000000000 --- a/src/core/support.js +++ /dev/null @@ -1,21 +0,0 @@ -define( [ - "../var/document", - "../var/support" -], function( document, support ) { - -// Support: Safari 8+ -// In Safari 8 documents created via document.implementation.createHTMLDocument -// collapse sibling forms: the second one becomes a child of the first one. -// Because of that, this security measure has to be disabled in Safari 8. -// https://bugs.webkit.org/show_bug.cgi?id=137337 -support.createHTMLDocument = ( function() { - if ( !document.implementation.createHTMLDocument ) { - return false; - } - var doc = document.implementation.createHTMLDocument( "" ); - doc.body.innerHTML = "<form></form><form></form>"; - return doc.body.childNodes.length === 2; -} )(); - -return support; -} ); |