mirror of https://github.com/sveltejs/svelte
fix: decode html entities correctly (#8047)
fixes #8026 1. replace the big entities list with entities that have a ; at the end where valid (there are some exceptions) 2. construct two regexes from that entities list: one for HTML where it's strictly matched, one for attributes where it tries to match browser behavior by also allowing = / digit / character afterwards 3. decode character references with one of these regexes depending on this is an attribute value or not --------- Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>pull/8328/head
parent
aa15a64cbe
commit
f34abc5689
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,19 @@
|
||||
export default {
|
||||
html: `
|
||||
<span data-xxx="&copy=value" style="&copy=value"></span>
|
||||
|
||||
<span data-xxx="&copy=value" style="&copy=value"></span>
|
||||
|
||||
<span data-xxx="©" style="©"></span>
|
||||
|
||||
<span data-xxx="©=value" style="©=value"></span>
|
||||
|
||||
<span data-xxx="&copyotherstring=value" style="&copyotherstring=value"></span>
|
||||
|
||||
<span data-xxx="&copy123=value" style="&copy123=value"></span>
|
||||
|
||||
<span data-xxx="&rect=value" style="&rect=value"></span>
|
||||
|
||||
<span data-xxx="▭=value" style="▭=value"></span>
|
||||
`
|
||||
};
|
@ -0,0 +1,15 @@
|
||||
<span data-xxx="©=value" style="©=value"></span>
|
||||
|
||||
<span data-xxx="©=value" style="©=value"></span>
|
||||
|
||||
<span data-xxx="©" style="©"></span>
|
||||
|
||||
<span data-xxx="©=value" style="©=value"></span>
|
||||
|
||||
<span data-xxx="©otherstring=value" style="©otherstring=value"></span>
|
||||
|
||||
<span data-xxx="©123=value" style="©123=value"></span>
|
||||
|
||||
<span data-xxx="&rect=value" style="&rect=value"></span>
|
||||
|
||||
<span data-xxx="▭=value" style="▭=value"></span>
|
@ -1,10 +1,24 @@
|
||||
<span>*</span>
|
||||
<span>*</span>
|
||||
<span>*</span>
|
||||
<span>*</span>
|
||||
<span>*</span>
|
||||
|
||||
<span> </span>
|
||||
<span>A</span>
|
||||
<span>€</span>
|
||||
<span>€</span>
|
||||
|
||||
<span>¬anentity;</span>
|
||||
<span>&stringnotanentity;</span>
|
||||
|
||||
<span>different &rect and ▭</span>
|
||||
|
||||
<span>©otherstring</span>
|
||||
|
||||
<span>©=otherstring</span>
|
||||
|
||||
<span>©=otherstring</span>
|
||||
|
||||
<span>©123</span>
|
||||
|
||||
<span>Ÿotherstring</span>
|
||||
|
Loading…
Reference in new issue