diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index f401dfb699f..239309f7c7d 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -201,6 +201,8 @@ class TagHelperTest < ActionView::TestCase content_tag(:p, "") assert_equal "

", content_tag(:p, "", nil, false) + assert_equal "
test
", + content_tag(:div, "test", "@click": "triggerNav()") end def test_tag_builder_with_content diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index d4ffff58965..597428ceeec 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -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}]/