@@ -485,35 +485,43 @@ def test_allow_data_attribute_if_requested
485
485
end
486
486
487
487
def test_uri_escaping_of_href_attr_in_a_tag_in_white_list_sanitizer
488
+ skip if RUBY_VERSION < "2.3"
489
+
488
490
html = %{<a href='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
489
491
490
492
text = white_list_sanitize ( html )
491
493
492
- assert_equal %{<a href="https://github.com/examp%3Cspan%20class="x x-first x-last">< !--%22%20unsafeattr=foo()>--> le.com">test</a>}, text
494
+ assert_equal %{<a href=\ " examp< !--%22%20unsafeattr=foo()>--> le.com\ " >test</a>} , text
493
495
end
494
496
495
497
def test_uri_escaping_of_src_attr_in_a_tag_in_white_list_sanitizer
498
+ skip if RUBY_VERSION < "2.3"
499
+
496
500
html = %{<a src='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
497
501
498
502
text = white_list_sanitize ( html )
499
503
500
- assert_equal %{<a src="https://github.com/examp%3Cspan%20class="x x-first x-last">< !--%22%20unsafeattr=foo()>--> le.com">test</a>}, text
504
+ assert_equal %{<a src=\ " examp< !--%22%20unsafeattr=foo()>--> le.com\ " >test</a>} , text
501
505
end
502
506
503
507
def test_uri_escaping_of_name_attr_in_a_tag_in_white_list_sanitizer
508
+ skip if RUBY_VERSION < "2.3"
509
+
504
510
html = %{<a name='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
505
511
506
512
text = white_list_sanitize ( html )
507
513
508
- assert_equal %{<a name="examp< !--%22%20unsafeattr=foo()>--> le.com">test</a>} , text
514
+ assert_equal %{<a name=\ " examp< !--%22%20unsafeattr=foo()>--> le.com\ " >test</a>} , text
509
515
end
510
516
511
517
def test_uri_escaping_of_name_action_in_a_tag_in_white_list_sanitizer
518
+ skip if RUBY_VERSION < "2.3"
519
+
512
520
html = %{<a action='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
513
521
514
522
text = white_list_sanitize ( html , attributes : [ 'action' ] )
515
523
516
- assert_equal %{<a action="https://github.com/examp%3Cspan%20class="x x-first x-last">< !--%22%20unsafeattr=foo()>--> le.com">test</a>}, text
524
+ assert_equal %{<a action=\ " examp< !--%22%20unsafeattr=foo()>--> le.com\ " >test</a>} , text
517
525
end
518
526
519
527
protected
0 commit comments