Fix Slowdown in Sanitizer Regexp
Deal with the issue: http://code.google.com/p/html5lib/issues/detail?id=83 by fixing a regexp used for sanitizing inline style attributes.
This commit is contained in:
parent
8f8c07505c
commit
5d7d89d193
|
@ -175,7 +175,7 @@ module Sanitizer
|
|||
|
||||
# gauntlet
|
||||
return '' unless style =~ /^([-:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/
|
||||
return '' unless style =~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$))*$/
|
||||
return '' unless style =~ /^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$/
|
||||
|
||||
clean = []
|
||||
style.scan(/([-\w]+)\s*:\s*([^:;]*)/) do |prop, val|
|
||||
|
|
|
@ -168,7 +168,7 @@ module HTML5
|
|||
|
||||
# gauntlet
|
||||
return '' unless style =~ /^([-:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/
|
||||
return '' unless style =~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$))*$/
|
||||
return '' unless style =~ /^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$/
|
||||
|
||||
clean = []
|
||||
style.scan(/([-\w]+)\s*:\s*([^:;]*)/) do |prop, val|
|
||||
|
|
Loading…
Reference in a new issue