Skip to content

Commit

Permalink
Add test and history entry for #83.
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrove committed May 19, 2014
1 parent 9332762 commit 88cc40d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ increment.
definitions will be removed from documents. Doctype definitions are never
allowed in fragments, regardless of this setting.

* Fixed: Non-tag brackets in input like "1 > 2 and 2 < 1" are now parsed and
escaped correctly in accordance with the HTML5 spec, becoming
"1 &gt; 2 and 2 &lt; 1". [#83][83]

* Fixed: Siblings added after the current node during traversal are now
also traversed. In previous versions they were simply skipped. [#91][91]

* Fixed: Nokogiri has been smacked and instructed to stop adding newlines after
certain elements, because if people wanted newlines there they'd have put them
there, dammit. [#103][103]

[83]:https://github.com/rgrove/sanitize/issues/83
[91]:https://github.com/rgrove/sanitize/issues/91
[103]:https://github.com/rgrove/sanitize/issues/103

Expand Down
9 changes: 7 additions & 2 deletions test/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
end

it 'should not have the Nokogiri 1.4.2+ unterminated script/style element bug' do
Sanitize.fragment('foo <script>bar').must_equal('foo bar')
Sanitize.fragment('foo <style>bar').must_equal('foo bar')
Sanitize.fragment('foo <script>bar').must_equal 'foo bar'
Sanitize.fragment('foo <style>bar').must_equal 'foo bar'
end

it 'ambiguous non-tag brackets like "1 > 2 and 2 < 1" should be parsed correctly' do
Sanitize.fragment('1 > 2 and 2 < 1').must_equal '1 &gt; 2 and 2 &lt; 1'
Sanitize.fragment('OMG HAPPY BIRTHDAY! *<:-D').must_equal 'OMG HAPPY BIRTHDAY! *&lt;:-D'
end

describe 'when siblings are added after a node during traversal' do
Expand Down

0 comments on commit 88cc40d

Please sign in to comment.