Skip to content

Commit

Permalink
Manipulation: Switch rnoInnerhtml to a version more performant in IE
Browse files Browse the repository at this point in the history
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/

Fixes gh-2563
Closes gh-2574
  • Loading branch information
SeanHenderson authored and mgol committed Sep 8, 2015
1 parent 1b566d3 commit d4def22
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ define( [

var
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,
Expand Down

0 comments on commit d4def22

Please sign in to comment.