]> source.dussan.org Git - jquery.git/commitdiff
Manipulation: Switch rnoInnerhtml to a version more performant in IE
authorSean Henderson <seanh.za@gmail.com>
Thu, 3 Sep 2015 15:48:20 +0000 (17:48 +0200)
committerMichał Gołębiowski <m.goleb@gmail.com>
Tue, 8 Sep 2015 17:35:06 +0000 (19:35 +0200)
IE versions greater than 9 do not handle the old regular expression well
with large html content. This is due to the use of a non-capturing group
after a very common html character (<).

Test suite: http://jsfiddle.net/Lwa0t5rp/3/
Microsoft bug: https://connect.microsoft.com/IE/feedback/details/1736512/

(cherry-picked from d4def22e4cd1c2eb2571f449e226b38384fb6d81)

Fixes gh-2563
Closes gh-2574

src/manipulation.js

index 738e21e4da3fc866b5832f510be4fe7c793f94ec..f52a5c4328a73db55d1845776a378aeba2b4ff67 100644 (file)
@@ -31,7 +31,11 @@ define( [
 var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
        rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
        rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
-       rnoInnerhtml = /<(?:script|style|link)/i,
+
+       // Support: IE 10-11, Edge 10240+
+       // In IE/Edge using regex groups here causes severe slowdowns.
+       // See https://connect.microsoft.com/IE/feedback/details/1736512/
+       rnoInnerhtml = /<script|<style|<link/i,
 
        // checked="checked" or checked
        rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,