From 082e92978803a90872f355e4ef698120bbd96f8f Mon Sep 17 00:00:00 2001 From: "Eileen M. Uchitelle" Date: Thu, 5 May 2022 14:46:19 -0400 Subject: [PATCH] Merge pull request #45027 from rails/fix-tag-helper-regression Fix tag helper regression --- actionview/test/template/tag_helper_test.rb | 2 ++ .../lib/active_support/core_ext/string/output_safety.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index 48840d9bc42f4..5bb70d02c92f7 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -201,6 +201,8 @@ def test_content_tag 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 d4ffff58965b0..597428ceeec43 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 @@ module Util 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}]/