Merge pull request #45027 from rails/fix-tag-helper-regression

Fix tag helper regression
This commit is contained in:
Eileen M. Uchitelle 2022-05-05 14:46:19 -04:00 committed by GitHub
commit 480edd4906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -201,6 +201,8 @@ class TagHelperTest < ActionView::TestCase
content_tag(:p, "<script>evil_js</script>")
assert_equal "<p><script>evil_js</script></p>",
content_tag(:p, "<script>evil_js</script>", nil, false)
assert_equal "<div @click=\"triggerNav()\">test</div>",
content_tag(:div, "test", "@click": "triggerNav()")
end
def test_tag_builder_with_content

View File

@ -12,7 +12,7 @@ class ERB
JSON_ESCAPE_REGEXP = /[\u2028\u2029&><]/u
# Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name
TAG_NAME_START_REGEXP_SET = ":A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}" \
TAG_NAME_START_REGEXP_SET = "@:A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}" \
"\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}" \
"\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}"
TAG_NAME_START_REGEXP = /[^#{TAG_NAME_START_REGEXP_SET}]/