Skip to content

html() uses a regular expression that performs badly in IE > 9 #2563

Closed
@SeanHenderson

Description

rnoInnerhtml = /<(?:script|style|link)/i

The above causes significant performance issues in IE 10 IE 11 and EDGE when inserting large amounts of HTML using the html function.

It can be re-written as the following:
rnoInnerhtml = /<script|<style|<link/i,

The above performs at the same level in other browsers and exponentially faster in IE .
My tests show for two columns for 4096 rows the difference is 18 seconds versus 5 milliseconds (IE 11).

http://jsfiddle.net/Lwa0t5rp/3/

Note when testing you the first test will always be slower than the second in chrome / firefox

Ticket logged at Microsoft however i think jQuery should be fixed anyways.
https://connect.microsoft.com/IE/feedback/details/1736512/regular-expressions-are-slower-in-edge-than-in-ie8

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions