packwerk 3.2.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/packwerk/application_validator.rb +2 -1
  3. data/lib/packwerk/graph.rb +15 -56
  4. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +1 -2
  5. data/lib/packwerk/run_context.rb +5 -0
  6. data/lib/packwerk/validators/dependency_validator.rb +5 -4
  7. data/lib/packwerk/version.rb +1 -1
  8. data/sorbet/rbi/gems/{actionpack@7.0.3.1.rbi → actionpack@7.0.8.7.rbi} +1338 -1227
  9. data/sorbet/rbi/gems/{actionview@7.0.3.1.rbi → actionview@7.0.8.7.rbi} +548 -503
  10. data/sorbet/rbi/gems/{activesupport@7.0.3.1.rbi → activesupport@7.0.8.7.rbi} +714 -635
  11. data/sorbet/rbi/gems/{better_html@2.0.1.rbi → better_html@2.1.1.rbi} +21 -21
  12. data/sorbet/rbi/gems/{concurrent-ruby@1.1.10.rbi → concurrent-ruby@1.3.5.rbi} +1390 -1366
  13. data/sorbet/rbi/gems/{constant_resolver@0.2.0.rbi → constant_resolver@0.3.0.rbi} +22 -13
  14. data/sorbet/rbi/gems/{erubi@1.11.0.rbi → erubi@1.13.1.rbi} +28 -17
  15. data/sorbet/rbi/gems/{i18n@1.12.0.rbi → i18n@1.14.7.rbi} +234 -172
  16. data/sorbet/rbi/gems/{json@2.6.2.rbi → json@2.7.2.rbi} +94 -74
  17. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  18. data/sorbet/rbi/gems/{loofah@2.18.0.rbi → loofah@2.24.0.rbi} +470 -243
  19. data/sorbet/rbi/gems/{minitest@5.16.2.rbi → minitest@5.25.4.rbi} +577 -472
  20. data/sorbet/rbi/gems/{mocha@1.14.0.rbi → mocha@2.5.0.rbi} +468 -684
  21. data/sorbet/rbi/gems/{nokogiri@1.15.3.rbi → nokogiri@1.18.4.rbi} +1756 -869
  22. data/sorbet/rbi/gems/{parallel@1.24.0.rbi → parallel@1.25.1.rbi} +26 -20
  23. data/sorbet/rbi/gems/{racc@1.7.1.rbi → racc@1.8.1.rbi} +36 -36
  24. data/sorbet/rbi/gems/{rack-test@2.0.2.rbi → rack-test@2.2.0.rbi} +87 -114
  25. data/sorbet/rbi/gems/{rack@2.2.4.rbi → rack@2.2.13.rbi} +243 -195
  26. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +754 -0
  27. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +764 -0
  28. data/sorbet/rbi/gems/{railties@7.0.3.1.rbi → railties@7.0.8.7.rbi} +146 -140
  29. data/sorbet/rbi/gems/{regexp_parser@2.5.0.rbi → regexp_parser@2.9.2.rbi} +947 -542
  30. data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.3.9.rbi} +452 -312
  31. data/sorbet/rbi/gems/{rubocop-ast@1.21.0.rbi → rubocop-ast@1.31.3.rbi} +717 -588
  32. data/sorbet/rbi/gems/{rubocop@1.34.1.rbi → rubocop@1.64.1.rbi} +10916 -4406
  33. data/sorbet/rbi/gems/{ruby-progressbar@1.11.0.rbi → ruby-progressbar@1.13.0.rbi} +359 -281
  34. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  35. data/sorbet/rbi/gems/{tzinfo@2.0.5.rbi → tzinfo@2.0.6.rbi} +144 -141
  36. data/sorbet/rbi/gems/{unicode-display_width@2.2.0.rbi → unicode-display_width@2.5.0.rbi} +24 -7
  37. metadata +36 -41
  38. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +0 -8
  39. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +0 -8
  40. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +0 -455
  41. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +0 -542
  42. data/sorbet/rbi/gems/ruby-lsp@0.2.3.rbi +0 -11
  43. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +0 -8
  44. /data/sorbet/rbi/gems/{builder@3.2.4.rbi → builder@3.3.0.rbi} +0 -0
  45. /data/sorbet/rbi/gems/{parser@3.3.1.0.rbi → parser@3.3.3.0.rbi} +0 -0
@@ -6,323 +6,476 @@
6
6
 
7
7
  # == Strings and IO Objects as Input
8
8
  #
9
- # Loofah.document and Loofah.fragment accept any IO object in addition
10
- # to accepting a string. That IO object could be a file, or a socket,
11
- # or a StringIO, or anything that responds to +read+ and
12
- # +close+. Which makes it particularly easy to sanitize mass
13
- # quantities of docs.
9
+ # The following methods accept any IO object in addition to accepting a string:
14
10
  #
15
- # source://loofah//lib/loofah/version.rb#2
11
+ # - Loofah.html4_document
12
+ # - Loofah.html4_fragment
13
+ # - Loofah.scrub_html4_document
14
+ # - Loofah.scrub_html4_fragment
15
+ #
16
+ # - Loofah.html5_document
17
+ # - Loofah.html5_fragment
18
+ # - Loofah.scrub_html5_document
19
+ # - Loofah.scrub_html5_fragment
20
+ #
21
+ # - Loofah.xml_document
22
+ # - Loofah.xml_fragment
23
+ # - Loofah.scrub_xml_document
24
+ # - Loofah.scrub_xml_fragment
25
+ #
26
+ # - Loofah.document
27
+ # - Loofah.fragment
28
+ # - Loofah.scrub_document
29
+ # - Loofah.scrub_fragment
30
+ #
31
+ # That IO object could be a file, or a socket, or a StringIO, or anything that responds to +read+
32
+ # and +close+.
33
+ #
34
+ # source://loofah//lib/loofah.rb#5
16
35
  module Loofah
17
36
  class << self
18
- # Shortcut for Loofah::HTML::Document.parse
19
- # This method accepts the same parameters as Nokogiri::HTML::Document.parse
37
+ # Shortcut for Loofah::HTML4::Document.parse(*args, &block)
38
+ #
39
+ # This method accepts the same parameters as Nokogiri::HTML4::Document.parse
20
40
  #
21
- # source://loofah//lib/loofah.rb#35
41
+ # source://loofah//lib/loofah.rb#76
22
42
  def document(*args, &block); end
23
43
 
24
- # Shortcut for Loofah::HTML::DocumentFragment.parse
25
- # This method accepts the same parameters as Nokogiri::HTML::DocumentFragment.parse
44
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
26
45
  #
27
- # source://loofah//lib/loofah.rb#41
46
+ # This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse
47
+ #
48
+ # source://loofah//lib/loofah.rb#83
28
49
  def fragment(*args, &block); end
29
50
 
51
+ # Shortcut for Loofah::HTML4::Document.parse(*args, &block)
52
+ #
53
+ # This method accepts the same parameters as Nokogiri::HTML4::Document.parse
54
+ #
55
+ # source://loofah//lib/loofah.rb#76
56
+ def html4_document(*args, &block); end
57
+
58
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
59
+ #
60
+ # This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse
61
+ #
62
+ # source://loofah//lib/loofah.rb#83
63
+ def html4_fragment(*args, &block); end
64
+
65
+ # source://loofah//lib/loofah.rb#101
66
+ def html5_document(*args, &block); end
67
+
68
+ # source://loofah//lib/loofah.rb#108
69
+ def html5_fragment(*args, &block); end
70
+
71
+ # @return [Boolean]
72
+ #
73
+ # source://loofah//lib/loofah.rb#7
74
+ def html5_support?; end
75
+
30
76
  # A helper to remove extraneous whitespace from text-ified HTML
31
77
  #
32
- # source://loofah//lib/loofah.rb#78
78
+ # source://loofah//lib/loofah.rb#169
33
79
  def remove_extraneous_whitespace(string); end
34
80
 
35
- # Shortcut for Loofah.document(string_or_io).scrub!(method)
81
+ # Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
36
82
  #
37
- # source://loofah//lib/loofah.rb#51
83
+ # source://loofah//lib/loofah.rb#88
38
84
  def scrub_document(string_or_io, method); end
39
85
 
40
- # Shortcut for Loofah.fragment(string_or_io).scrub!(method)
86
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
41
87
  #
42
- # source://loofah//lib/loofah.rb#46
88
+ # source://loofah//lib/loofah.rb#93
43
89
  def scrub_fragment(string_or_io, method); end
44
90
 
91
+ # Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
92
+ #
93
+ # source://loofah//lib/loofah.rb#88
94
+ def scrub_html4_document(string_or_io, method); end
95
+
96
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
97
+ #
98
+ # source://loofah//lib/loofah.rb#93
99
+ def scrub_html4_fragment(string_or_io, method); end
100
+
101
+ # source://loofah//lib/loofah.rb#113
102
+ def scrub_html5_document(string_or_io, method); end
103
+
104
+ # source://loofah//lib/loofah.rb#118
105
+ def scrub_html5_fragment(string_or_io, method); end
106
+
45
107
  # Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
46
108
  #
47
- # source://loofah//lib/loofah.rb#73
109
+ # source://loofah//lib/loofah.rb#164
48
110
  def scrub_xml_document(string_or_io, method); end
49
111
 
50
112
  # Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
51
113
  #
52
- # source://loofah//lib/loofah.rb#68
114
+ # source://loofah//lib/loofah.rb#159
53
115
  def scrub_xml_fragment(string_or_io, method); end
54
116
 
55
- # Shortcut for Loofah::XML::Document.parse
117
+ # Shortcut for Loofah::XML::Document.parse(*args, &block)
118
+ #
56
119
  # This method accepts the same parameters as Nokogiri::XML::Document.parse
57
120
  #
58
- # source://loofah//lib/loofah.rb#57
121
+ # source://loofah//lib/loofah.rb#147
59
122
  def xml_document(*args, &block); end
60
123
 
61
- # Shortcut for Loofah::XML::DocumentFragment.parse
124
+ # Shortcut for Loofah::XML::DocumentFragment.parse(*args, &block)
125
+ #
62
126
  # This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse
63
127
  #
64
- # source://loofah//lib/loofah.rb#63
128
+ # source://loofah//lib/loofah.rb#154
65
129
  def xml_fragment(*args, &block); end
66
-
67
- private
68
-
69
- # remove comments that exist outside of the HTML element.
70
- #
71
- # these comments are allowed by the HTML spec:
72
- #
73
- # https://www.w3.org/TR/html401/struct/global.html#h-7.1
74
- #
75
- # but are not scrubbed by Loofah because these nodes don't meet
76
- # the contract that scrubbers expect of a node (e.g., it can be
77
- # replaced, sibling and children nodes can be created).
78
- #
79
- # source://loofah//lib/loofah.rb#93
80
- def remove_comments_before_html_element(doc); end
81
130
  end
82
131
  end
83
132
 
84
- # source://loofah//lib/loofah/instance_methods.rb#126
133
+ # source://loofah//lib/loofah/concerns.rb#125
85
134
  module Loofah::DocumentDecorator
86
- # source://loofah//lib/loofah/instance_methods.rb#127
135
+ # source://loofah//lib/loofah/concerns.rb#126
87
136
  def initialize(*args, &block); end
88
137
  end
89
138
 
90
- # source://loofah//lib/loofah/elements.rb#5
139
+ # source://loofah//lib/loofah/elements.rb#6
91
140
  module Loofah::Elements; end
92
141
 
93
- # source://loofah//lib/loofah/elements.rb#91
142
+ # source://loofah//lib/loofah/elements.rb#93
94
143
  Loofah::Elements::BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
95
144
 
96
145
  # Elements that aren't block but should generate a newline in #to_text
97
146
  #
98
- # source://loofah//lib/loofah/elements.rb#88
147
+ # source://loofah//lib/loofah/elements.rb#90
99
148
  Loofah::Elements::INLINE_LINE_BREAK = T.let(T.unsafe(nil), Set)
100
149
 
101
- # source://loofah//lib/loofah/elements.rb#92
150
+ # source://loofah//lib/loofah/elements.rb#94
102
151
  Loofah::Elements::LINEBREAKERS = T.let(T.unsafe(nil), Set)
103
152
 
104
153
  # The following elements may also be considered block-level
105
154
  # elements since they may contain block-level elements
106
155
  #
107
- # source://loofah//lib/loofah/elements.rb#75
156
+ # source://loofah//lib/loofah/elements.rb#76
108
157
  Loofah::Elements::LOOSE_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
109
158
 
110
- # source://loofah//lib/loofah/elements.rb#90
159
+ # source://loofah//lib/loofah/elements.rb#92
111
160
  Loofah::Elements::STRICT_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
112
161
 
113
- # source://loofah//lib/loofah/elements.rb#6
162
+ # source://loofah//lib/loofah/elements.rb#7
114
163
  Loofah::Elements::STRICT_BLOCK_LEVEL_HTML4 = T.let(T.unsafe(nil), Set)
115
164
 
116
165
  # https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
117
166
  #
118
- # source://loofah//lib/loofah/elements.rb#34
167
+ # source://loofah//lib/loofah/elements.rb#35
119
168
  Loofah::Elements::STRICT_BLOCK_LEVEL_HTML5 = T.let(T.unsafe(nil), Set)
120
169
 
121
- # source://loofah//lib/loofah/html/document.rb#3
122
- module Loofah::HTML; end
170
+ # Alias for Loofah::HTML4
171
+ #
172
+ # source://loofah//lib/loofah.rb#70
173
+ Loofah::HTML = Loofah::HTML4
123
174
 
124
- # source://loofah//lib/loofah/html5/safelist.rb#5
175
+ # source://loofah//lib/loofah/html4/document.rb#4
176
+ module Loofah::HTML4; end
177
+
178
+ # Subclass of Nokogiri::HTML4::Document.
179
+ #
180
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
181
+ #
182
+ # source://loofah//lib/loofah/html4/document.rb#10
183
+ class Loofah::HTML4::Document < ::Nokogiri::HTML4::Document
184
+ include ::Loofah::ScrubBehavior::Node
185
+ include ::Loofah::DocumentDecorator
186
+ include ::Loofah::TextBehavior
187
+ include ::Loofah::HtmlDocumentBehavior
188
+ extend ::Loofah::HtmlDocumentBehavior::ClassMethods
189
+ end
190
+
191
+ # Subclass of Nokogiri::HTML4::DocumentFragment.
192
+ #
193
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
194
+ #
195
+ # source://loofah//lib/loofah/html4/document_fragment.rb#10
196
+ class Loofah::HTML4::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
197
+ include ::Loofah::TextBehavior
198
+ include ::Loofah::HtmlFragmentBehavior
199
+ extend ::Loofah::HtmlFragmentBehavior::ClassMethods
200
+ end
201
+
202
+ # source://loofah//lib/loofah/html5/safelist.rb#6
125
203
  module Loofah::HTML5; end
126
204
 
127
- # source://loofah//lib/loofah/html5/safelist.rb#48
205
+ # Subclass of Nokogiri::HTML5::Document.
206
+ #
207
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
208
+ #
209
+ # source://loofah//lib/loofah/html5/document.rb#10
210
+ class Loofah::HTML5::Document < ::Nokogiri::HTML5::Document
211
+ include ::Loofah::ScrubBehavior::Node
212
+ include ::Loofah::DocumentDecorator
213
+ include ::Loofah::TextBehavior
214
+ include ::Loofah::HtmlDocumentBehavior
215
+ extend ::Loofah::HtmlDocumentBehavior::ClassMethods
216
+ end
217
+
218
+ # Subclass of Nokogiri::HTML5::DocumentFragment.
219
+ #
220
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
221
+ #
222
+ # source://loofah//lib/loofah/html5/document_fragment.rb#10
223
+ class Loofah::HTML5::DocumentFragment < ::Nokogiri::HTML5::DocumentFragment
224
+ include ::Loofah::TextBehavior
225
+ include ::Loofah::HtmlFragmentBehavior
226
+ extend ::Loofah::HtmlFragmentBehavior::ClassMethods
227
+ end
228
+
229
+ # source://loofah//lib/loofah/html5/safelist.rb#49
128
230
  module Loofah::HTML5::SafeList; end
129
231
 
130
- # source://loofah//lib/loofah/html5/safelist.rb#226
232
+ # source://loofah//lib/loofah/html5/safelist.rb#232
131
233
  Loofah::HTML5::SafeList::ACCEPTABLE_ATTRIBUTES = T.let(T.unsafe(nil), Set)
132
234
 
235
+ # https://www.w3.org/TR/css-color-3/#html4
236
+ #
237
+ # source://loofah//lib/loofah/html5/safelist.rb#738
238
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_COLORS = T.let(T.unsafe(nil), Set)
239
+
240
+ # https://www.w3.org/TR/css-color-3/#svg-color
241
+ #
242
+ # source://loofah//lib/loofah/html5/safelist.rb#758
243
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_EXTENDED_COLORS = T.let(T.unsafe(nil), Set)
244
+
133
245
  # see https://www.quackit.com/css/functions/
134
246
  # omit `url` and `image` from that list
135
247
  #
136
- # source://loofah//lib/loofah/html5/safelist.rb#742
248
+ # source://loofah//lib/loofah/html5/safelist.rb#910
137
249
  Loofah::HTML5::SafeList::ACCEPTABLE_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
138
250
 
139
- # source://loofah//lib/loofah/html5/safelist.rb#685
251
+ # source://loofah//lib/loofah/html5/safelist.rb#699
140
252
  Loofah::HTML5::SafeList::ACCEPTABLE_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
141
253
 
142
- # source://loofah//lib/loofah/html5/safelist.rb#615
254
+ # source://loofah//lib/loofah/html5/safelist.rb#626
143
255
  Loofah::HTML5::SafeList::ACCEPTABLE_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
144
256
 
145
- # source://loofah//lib/loofah/html5/safelist.rb#49
257
+ # source://loofah//lib/loofah/html5/safelist.rb#50
146
258
  Loofah::HTML5::SafeList::ACCEPTABLE_ELEMENTS = T.let(T.unsafe(nil), Set)
147
259
 
148
- # source://loofah//lib/loofah/html5/safelist.rb#815
260
+ # source://loofah//lib/loofah/html5/safelist.rb#983
149
261
  Loofah::HTML5::SafeList::ACCEPTABLE_PROTOCOLS = T.let(T.unsafe(nil), Set)
150
262
 
151
- # source://loofah//lib/loofah/html5/safelist.rb#802
263
+ # source://loofah//lib/loofah/html5/safelist.rb#970
152
264
  Loofah::HTML5::SafeList::ACCEPTABLE_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
153
265
 
154
- # source://loofah//lib/loofah/html5/safelist.rb#844
266
+ # source://loofah//lib/loofah/html5/safelist.rb#1014
155
267
  Loofah::HTML5::SafeList::ACCEPTABLE_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
156
268
 
157
- # source://loofah//lib/loofah/html5/safelist.rb#855
269
+ # source://loofah//lib/loofah/html5/safelist.rb#1024
158
270
  Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES = T.let(T.unsafe(nil), Set)
159
271
 
160
- # source://loofah//lib/loofah/html5/safelist.rb#858
272
+ # source://loofah//lib/loofah/html5/safelist.rb#1027
161
273
  Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
162
274
 
163
- # source://loofah//lib/loofah/html5/safelist.rb#857
275
+ # source://loofah//lib/loofah/html5/safelist.rb#1026
164
276
  Loofah::HTML5::SafeList::ALLOWED_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
165
277
 
166
- # source://loofah//lib/loofah/html5/safelist.rb#856
278
+ # source://loofah//lib/loofah/html5/safelist.rb#1025
167
279
  Loofah::HTML5::SafeList::ALLOWED_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
168
280
 
169
281
  # subclasses may define their own versions of these constants
170
282
  #
171
- # source://loofah//lib/loofah/html5/safelist.rb#854
283
+ # source://loofah//lib/loofah/html5/safelist.rb#1023
172
284
  Loofah::HTML5::SafeList::ALLOWED_ELEMENTS = T.let(T.unsafe(nil), Set)
173
285
 
174
- # source://loofah//lib/loofah/html5/safelist.rb#879
286
+ # source://loofah//lib/loofah/html5/safelist.rb#1048
175
287
  Loofah::HTML5::SafeList::ALLOWED_ELEMENTS_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
176
288
 
177
- # source://loofah//lib/loofah/html5/safelist.rb#860
289
+ # source://loofah//lib/loofah/html5/safelist.rb#1029
178
290
  Loofah::HTML5::SafeList::ALLOWED_PROTOCOLS = T.let(T.unsafe(nil), Set)
179
291
 
180
- # source://loofah//lib/loofah/html5/safelist.rb#859
292
+ # source://loofah//lib/loofah/html5/safelist.rb#1028
181
293
  Loofah::HTML5::SafeList::ALLOWED_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
182
294
 
183
- # source://loofah//lib/loofah/html5/safelist.rb#861
295
+ # source://loofah//lib/loofah/html5/safelist.rb#1030
184
296
  Loofah::HTML5::SafeList::ALLOWED_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
185
297
 
186
- # source://loofah//lib/loofah/html5/safelist.rb#515
298
+ # source://loofah//lib/loofah/html5/safelist.rb#526
187
299
  Loofah::HTML5::SafeList::ARIA_ATTRIBUTES = T.let(T.unsafe(nil), Set)
188
300
 
189
- # source://loofah//lib/loofah/html5/safelist.rb#571
301
+ # source://loofah//lib/loofah/html5/safelist.rb#582
190
302
  Loofah::HTML5::SafeList::ATTR_VAL_IS_URI = T.let(T.unsafe(nil), Set)
191
303
 
192
- # source://loofah//lib/loofah/html5/safelist.rb#309
304
+ # source://loofah//lib/loofah/html5/safelist.rb#315
193
305
  Loofah::HTML5::SafeList::MATHML_ATTRIBUTES = T.let(T.unsafe(nil), Set)
194
306
 
195
- # source://loofah//lib/loofah/html5/safelist.rb#146
307
+ # source://loofah//lib/loofah/html5/safelist.rb#147
196
308
  Loofah::HTML5::SafeList::MATHML_ELEMENTS = T.let(T.unsafe(nil), Set)
197
309
 
198
- # source://loofah//lib/loofah/html5/safelist.rb#813
310
+ # source://loofah//lib/loofah/html5/safelist.rb#981
199
311
  Loofah::HTML5::SafeList::PROTOCOL_SEPARATOR = T.let(T.unsafe(nil), Regexp)
200
312
 
201
- # source://loofah//lib/loofah/html5/safelist.rb#795
313
+ # source://loofah//lib/loofah/html5/safelist.rb#963
202
314
  Loofah::HTML5::SafeList::SHORTHAND_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
203
315
 
204
- # source://loofah//lib/loofah/html5/safelist.rb#597
316
+ # source://loofah//lib/loofah/html5/safelist.rb#608
205
317
  Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF = T.let(T.unsafe(nil), Set)
206
318
 
207
- # source://loofah//lib/loofah/html5/safelist.rb#361
319
+ # source://loofah//lib/loofah/html5/safelist.rb#367
208
320
  Loofah::HTML5::SafeList::SVG_ATTRIBUTES = T.let(T.unsafe(nil), Set)
209
321
 
210
- # source://loofah//lib/loofah/html5/safelist.rb#583
322
+ # source://loofah//lib/loofah/html5/safelist.rb#594
211
323
  Loofah::HTML5::SafeList::SVG_ATTR_VAL_ALLOWS_REF = T.let(T.unsafe(nil), Set)
212
324
 
213
- # source://loofah//lib/loofah/html5/safelist.rb#182
325
+ # source://loofah//lib/loofah/html5/safelist.rb#183
214
326
  Loofah::HTML5::SafeList::SVG_ELEMENTS = T.let(T.unsafe(nil), Set)
215
327
 
216
328
  # additional tags we should consider safe since we have libxml2 fixing up our documents.
217
329
  #
218
- # source://loofah//lib/loofah/html5/safelist.rb#874
330
+ # source://loofah//lib/loofah/html5/safelist.rb#1043
219
331
  Loofah::HTML5::SafeList::TAGS_SAFE_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
220
332
 
221
333
  # TODO: remove VOID_ELEMENTS in a future major release
222
334
  # and put it in the tests (it is used only for testing, not for functional behavior)
223
335
  #
224
- # source://loofah//lib/loofah/html5/safelist.rb#865
336
+ # source://loofah//lib/loofah/html5/safelist.rb#1034
225
337
  Loofah::HTML5::SafeList::VOID_ELEMENTS = T.let(T.unsafe(nil), Set)
226
338
 
227
- # source://loofah//lib/loofah/html5/scrub.rb#7
339
+ # source://loofah//lib/loofah/html5/scrub.rb#8
228
340
  module Loofah::HTML5::Scrub
229
341
  class << self
230
342
  # @return [Boolean]
231
343
  #
232
- # source://loofah//lib/loofah/html5/scrub.rb#16
344
+ # source://loofah//lib/loofah/html5/scrub.rb#18
233
345
  def allowed_element?(element_name); end
234
346
 
347
+ # source://loofah//lib/loofah/html5/scrub.rb#192
348
+ def cdata_escape(node); end
349
+
350
+ # @return [Boolean]
351
+ #
352
+ # source://loofah//lib/loofah/html5/scrub.rb#187
353
+ def cdata_needs_escaping?(node); end
354
+
355
+ # source://loofah//lib/loofah/html5/scrub.rb#207
356
+ def escape_tags(string); end
357
+
235
358
  # libxml2 >= 2.9.2 fails to escape comments within some attributes.
236
359
  #
237
360
  # see comments about CVE-2018-8048 within the tests for more information
238
361
  #
239
- # source://loofah//lib/loofah/html5/scrub.rb#135
362
+ # source://loofah//lib/loofah/html5/scrub.rb#166
240
363
  def force_correct_attribute_escaping!(node); end
241
364
 
365
+ # source://loofah//lib/loofah/html5/scrub.rb#123
366
+ def scrub_attribute_that_allows_local_ref(attr_node); end
367
+
242
368
  # alternative implementation of the html5lib attribute scrubbing algorithm
243
369
  #
244
- # source://loofah//lib/loofah/html5/scrub.rb#21
370
+ # source://loofah//lib/loofah/html5/scrub.rb#23
245
371
  def scrub_attributes(node); end
246
372
 
247
- # source://loofah//lib/loofah/html5/scrub.rb#79
373
+ # source://loofah//lib/loofah/html5/scrub.rb#72
248
374
  def scrub_css(style); end
249
375
 
250
- # source://loofah//lib/loofah/html5/scrub.rb#74
376
+ # source://loofah//lib/loofah/html5/scrub.rb#67
251
377
  def scrub_css_attribute(node); end
378
+
379
+ # source://loofah//lib/loofah/html5/scrub.rb#142
380
+ def scrub_uri_attribute(attr_node); end
252
381
  end
253
382
  end
254
383
 
255
- # source://loofah//lib/loofah/html5/scrub.rb#8
384
+ # source://loofah//lib/loofah/html5/scrub.rb#9
256
385
  Loofah::HTML5::Scrub::CONTROL_CHARACTERS = T.let(T.unsafe(nil), Regexp)
257
386
 
258
- # source://loofah//lib/loofah/html5/scrub.rb#10
387
+ # source://loofah//lib/loofah/html5/scrub.rb#11
259
388
  Loofah::HTML5::Scrub::CRASS_SEMICOLON = T.let(T.unsafe(nil), Hash)
260
389
 
261
- # source://loofah//lib/loofah/html5/scrub.rb#11
390
+ # source://loofah//lib/loofah/html5/scrub.rb#12
262
391
  Loofah::HTML5::Scrub::CSS_IMPORTANT = T.let(T.unsafe(nil), String)
263
392
 
264
- # source://loofah//lib/loofah/html5/scrub.rb#9
393
+ # source://loofah//lib/loofah/html5/scrub.rb#10
265
394
  Loofah::HTML5::Scrub::CSS_KEYWORDISH = T.let(T.unsafe(nil), Regexp)
266
395
 
267
- # source://loofah//lib/loofah/html5/scrub.rb#12
396
+ # source://loofah//lib/loofah/html5/scrub.rb#14
268
397
  Loofah::HTML5::Scrub::CSS_PROPERTY_STRING_WITHOUT_EMBEDDED_QUOTES = T.let(T.unsafe(nil), Regexp)
269
398
 
270
399
  # source://loofah//lib/loofah/html5/scrub.rb#13
400
+ Loofah::HTML5::Scrub::CSS_WHITESPACE = T.let(T.unsafe(nil), String)
401
+
402
+ # source://loofah//lib/loofah/html5/scrub.rb#15
271
403
  Loofah::HTML5::Scrub::DATA_ATTRIBUTE_NAME = T.let(T.unsafe(nil), Regexp)
272
404
 
273
- # source://loofah//lib/loofah/html5/safelist.rb#882
405
+ # source://loofah//lib/loofah/html5/safelist.rb#1051
274
406
  Loofah::HTML5::WhiteList = Loofah::HTML5::SafeList
275
407
 
276
- # Subclass of Nokogiri::HTML::Document.
277
- #
278
- # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
279
- #
280
- # source://loofah//lib/loofah/html/document.rb#9
281
- class Loofah::HTML::Document < ::Nokogiri::HTML4::Document
282
- include ::Loofah::ScrubBehavior::Node
283
- include ::Loofah::DocumentDecorator
284
- include ::Loofah::TextBehavior
408
+ # source://loofah//lib/loofah/concerns.rb#133
409
+ module Loofah::HtmlDocumentBehavior
410
+ mixes_in_class_methods ::Loofah::HtmlDocumentBehavior::ClassMethods
285
411
 
286
- # source://loofah//lib/loofah/html/document.rb#14
412
+ # source://loofah//lib/loofah/concerns.rb#164
287
413
  def serialize_root; end
414
+
415
+ class << self
416
+ # @private
417
+ #
418
+ # source://loofah//lib/loofah/concerns.rb#159
419
+ def included(base); end
420
+ end
288
421
  end
289
422
 
290
- # Subclass of Nokogiri::HTML::DocumentFragment.
291
- #
292
- # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
293
- #
294
- # source://loofah//lib/loofah/html/document_fragment.rb#9
295
- class Loofah::HTML::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
296
- include ::Loofah::TextBehavior
423
+ # source://loofah//lib/loofah/concerns.rb#134
424
+ module Loofah::HtmlDocumentBehavior::ClassMethods
425
+ # source://loofah//lib/loofah/concerns.rb#135
426
+ def parse(*args, &block); end
297
427
 
298
- # Returns the HTML markup contained by the fragment
428
+ private
429
+
430
+ # remove comments that exist outside of the HTML element.
431
+ #
432
+ # these comments are allowed by the HTML spec:
433
+ #
434
+ # https://www.w3.org/TR/html401/struct/global.html#h-7.1
299
435
  #
300
- # source://loofah//lib/loofah/html/document_fragment.rb#31
436
+ # but are not scrubbed by Loofah because these nodes don't meet
437
+ # the contract that scrubbers expect of a node (e.g., it can be
438
+ # replaced, sibling and children nodes can be created).
439
+ #
440
+ # source://loofah//lib/loofah/concerns.rb#150
441
+ def remove_comments_before_html_element(doc); end
442
+ end
443
+
444
+ # source://loofah//lib/loofah/concerns.rb#169
445
+ module Loofah::HtmlFragmentBehavior
446
+ mixes_in_class_methods ::Loofah::HtmlFragmentBehavior::ClassMethods
447
+
448
+ # source://loofah//lib/loofah/concerns.rb#197
301
449
  def serialize; end
302
450
 
303
- # source://loofah//lib/loofah/html/document_fragment.rb#37
451
+ # source://loofah//lib/loofah/concerns.rb#203
304
452
  def serialize_root; end
305
453
 
306
- # Returns the HTML markup contained by the fragment
307
- #
308
- # source://loofah//lib/loofah/html/document_fragment.rb#31
454
+ # source://loofah//lib/loofah/concerns.rb#197
309
455
  def to_s; end
310
456
 
311
457
  class << self
312
- # Overridden Nokogiri::HTML::DocumentFragment
313
- # constructor. Applications should use Loofah.fragment to
314
- # parse a fragment.
458
+ # @private
315
459
  #
316
- # source://loofah//lib/loofah/html/document_fragment.rb#18
317
- def parse(tags, encoding = T.unsafe(nil)); end
460
+ # source://loofah//lib/loofah/concerns.rb#192
461
+ def included(base); end
318
462
  end
319
463
  end
320
464
 
465
+ # source://loofah//lib/loofah/concerns.rb#170
466
+ module Loofah::HtmlFragmentBehavior::ClassMethods
467
+ # source://loofah//lib/loofah/concerns.rb#180
468
+ def document_klass; end
469
+
470
+ # source://loofah//lib/loofah/concerns.rb#171
471
+ def parse(tags, encoding = T.unsafe(nil)); end
472
+ end
473
+
321
474
  # constants related to working around unhelpful libxml2 behavior
322
475
  #
323
476
  # ಠ_ಠ
324
477
  #
325
- # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#11
478
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#12
326
479
  module Loofah::LibxmlWorkarounds; end
327
480
 
328
481
  # these attributes and qualifying parent tags are determined by the code at:
@@ -331,63 +484,62 @@ module Loofah::LibxmlWorkarounds; end
331
484
  #
332
485
  # see comments about CVE-2018-8048 within the tests for more information
333
486
  #
334
- # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#19
487
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#20
335
488
  Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES = T.let(T.unsafe(nil), Set)
336
489
 
337
- # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#25
490
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#26
338
491
  Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = T.let(T.unsafe(nil), Hash)
339
492
 
340
- # source://loofah//lib/loofah/metahelpers.rb#3
493
+ # source://loofah//lib/loofah/metahelpers.rb#4
341
494
  module Loofah::MetaHelpers
342
495
  class << self
343
- # source://loofah//lib/loofah/metahelpers.rb#4
496
+ # source://loofah//lib/loofah/metahelpers.rb#6
344
497
  def add_downcased_set_members_to_all_set_constants(mojule); end
345
498
  end
346
499
  end
347
500
 
348
501
  # Mixes +scrub!+ into Document, DocumentFragment, Node and NodeSet.
349
502
  #
350
- # Traverse the document or fragment, invoking the +scrubber+ on
351
- # each node.
503
+ # Traverse the document or fragment, invoking the +scrubber+ on each node.
352
504
  #
353
- # +scrubber+ must either be one of the symbols representing the
354
- # built-in scrubbers (see Scrubbers), or a Scrubber instance.
505
+ # +scrubber+ must either be one of the symbols representing the built-in scrubbers (see
506
+ # Scrubbers), or a Scrubber instance.
355
507
  #
356
508
  # span2div = Loofah::Scrubber.new do |node|
357
509
  # node.name = "div" if node.name == "span"
358
510
  # end
359
- # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
511
+ # Loofah.html5_fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
360
512
  # # => "<div>foo</div><p>bar</p>"
361
513
  #
362
514
  # or
363
515
  #
364
516
  # unsafe_html = "ohai! <div>div is safe</div> <script>but script is not</script>"
365
- # Loofah.fragment(unsafe_html).scrub!(:strip).to_s
517
+ # Loofah.html5_fragment(unsafe_html).scrub!(:strip).to_s
366
518
  # # => "ohai! <div>div is safe</div> "
367
519
  #
368
- # Note that this method is called implicitly from
369
- # Loofah.scrub_fragment and Loofah.scrub_document.
520
+ # Note that this method is called implicitly from the shortcuts Loofah.scrub_html5_fragment et
521
+ # al.
370
522
  #
371
- # Please see Scrubber for more information on implementation and traversal, and
372
- # README.rdoc for more example usage.
523
+ # Please see Scrubber for more information on implementation and traversal, and README.rdoc for
524
+ # more example usage.
373
525
  #
374
- # source://loofah//lib/loofah/instance_methods.rb#30
526
+ # source://loofah//lib/loofah/concerns.rb#30
375
527
  module Loofah::ScrubBehavior
376
528
  class << self
377
- # source://loofah//lib/loofah/instance_methods.rb#60
529
+ # source://loofah//lib/loofah/concerns.rb#59
378
530
  def resolve_scrubber(scrubber); end
379
531
  end
380
532
  end
381
533
 
382
- # source://loofah//lib/loofah/instance_methods.rb#31
534
+ # source://loofah//lib/loofah/concerns.rb#31
383
535
  module Loofah::ScrubBehavior::Node
384
- # source://loofah//lib/loofah/instance_methods.rb#32
536
+ # source://loofah//lib/loofah/concerns.rb#32
385
537
  def scrub!(scrubber); end
386
538
  end
387
539
 
388
- # source://loofah//lib/loofah/instance_methods.rb#53
540
+ # source://loofah//lib/loofah/concerns.rb#51
389
541
  module Loofah::ScrubBehavior::NodeSet
390
- # source://loofah//lib/loofah/instance_methods.rb#54
542
+ # source://loofah//lib/loofah/concerns.rb#52
391
543
  def scrub!(scrubber); end
392
544
  end
393
545
 
@@ -409,14 +561,14 @@ end
409
561
  #
410
562
  # This can then be run on a document:
411
563
  #
412
- # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
564
+ # Loofah.html5_fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
413
565
  # # => "<div>foo</div><p>bar</p>"
414
566
  #
415
567
  # Scrubbers can be run on a document in either a top-down traversal (the
416
568
  # default) or bottom-up. Top-down scrubbers can optionally return
417
569
  # Scrubber::STOP to terminate the traversal of a subtree.
418
570
  #
419
- # source://loofah//lib/loofah/scrubber.rb#34
571
+ # source://loofah//lib/loofah/scrubber.rb#35
420
572
  class Loofah::Scrubber
421
573
  # Options may include
422
574
  # :direction => :top_down (the default)
@@ -439,7 +591,7 @@ class Loofah::Scrubber
439
591
  # If the attribute is not set, add it
440
592
  # If the attribute is set, don't overwrite the existing value
441
593
  #
442
- # source://loofah//lib/loofah/scrubber.rb#94
594
+ # source://loofah//lib/loofah/scrubber.rb#96
443
595
  def append_attribute(node, attribute, value); end
444
596
 
445
597
  # When a scrubber is initialized, the optional block is saved as
@@ -460,25 +612,25 @@ class Loofah::Scrubber
460
612
  #
461
613
  # @raise [ScrubberNotFound]
462
614
  #
463
- # source://loofah//lib/loofah/scrubber.rb#86
615
+ # source://loofah//lib/loofah/scrubber.rb#88
464
616
  def scrub(node); end
465
617
 
466
618
  # Calling +traverse+ will cause the document to be traversed by
467
619
  # either the lambda passed to the initializer or the +scrub+
468
620
  # method, in the direction specified at +new+ time.
469
621
  #
470
- # source://loofah//lib/loofah/scrubber.rb#78
622
+ # source://loofah//lib/loofah/scrubber.rb#80
471
623
  def traverse(node); end
472
624
 
473
625
  private
474
626
 
475
- # source://loofah//lib/loofah/scrubber.rb#103
627
+ # source://loofah//lib/loofah/scrubber.rb#105
476
628
  def html5lib_sanitize(node); end
477
629
 
478
- # source://loofah//lib/loofah/scrubber.rb#125
630
+ # source://loofah//lib/loofah/scrubber.rb#131
479
631
  def traverse_conditionally_bottom_up(node); end
480
632
 
481
- # source://loofah//lib/loofah/scrubber.rb#116
633
+ # source://loofah//lib/loofah/scrubber.rb#122
482
634
  def traverse_conditionally_top_down(node); end
483
635
  end
484
636
 
@@ -494,7 +646,7 @@ Loofah::Scrubber::STOP = T.let(T.unsafe(nil), Object)
494
646
 
495
647
  # A RuntimeError raised when Loofah could not find an appropriate scrubber.
496
648
  #
497
- # source://loofah//lib/loofah/scrubber.rb#6
649
+ # source://loofah//lib/loofah/scrubber.rb#7
498
650
  class Loofah::ScrubberNotFound < ::RuntimeError; end
499
651
 
500
652
  # Loofah provides some built-in scrubbers for sanitizing with
@@ -507,7 +659,7 @@ class Loofah::ScrubberNotFound < ::RuntimeError; end
507
659
  # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
508
660
  #
509
661
  # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
510
- # Loofah.fragment(unsafe_html).scrub!(:strip)
662
+ # Loofah.html5_fragment(unsafe_html).scrub!(:strip)
511
663
  # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
512
664
  #
513
665
  #
@@ -516,7 +668,7 @@ class Loofah::ScrubberNotFound < ::RuntimeError; end
516
668
  # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
517
669
  #
518
670
  # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
519
- # Loofah.fragment(unsafe_html).scrub!(:prune)
671
+ # Loofah.html5_fragment(unsafe_html).scrub!(:prune)
520
672
  # => "ohai! <div>div is safe</div> "
521
673
  #
522
674
  #
@@ -525,7 +677,7 @@ class Loofah::ScrubberNotFound < ::RuntimeError; end
525
677
  # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
526
678
  #
527
679
  # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
528
- # Loofah.fragment(unsafe_html).scrub!(:escape)
680
+ # Loofah.html5_fragment(unsafe_html).scrub!(:escape)
529
681
  # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
530
682
  #
531
683
  #
@@ -537,7 +689,7 @@ class Loofah::ScrubberNotFound < ::RuntimeError; end
537
689
  # layer of paint on top of the HTML input to make it look nice.
538
690
  #
539
691
  # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
540
- # Loofah.fragment(messy_markup).scrub!(:whitewash)
692
+ # Loofah.html5_fragment(messy_markup).scrub!(:whitewash)
541
693
  # => "ohai! <div>div with attributes</div>"
542
694
  #
543
695
  # One use case for this scrubber is to clean up HTML that was
@@ -552,25 +704,42 @@ class Loofah::ScrubberNotFound < ::RuntimeError; end
552
704
  # +:nofollow+ adds a rel="nofollow" attribute to all links
553
705
  #
554
706
  # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
555
- # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
707
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:nofollow)
556
708
  # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
557
709
  #
558
710
  #
711
+ # === Loofah::Scrubbers::TargetBlank / scrub!(:targetblank)
712
+ #
713
+ # +:targetblank+ adds a target="_blank" attribute to all links
714
+ #
715
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
716
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:targetblank)
717
+ # => "ohai! <a href='http://www.myswarmysite.com/' target="_blank">I like your blog post</a>"
718
+ #
719
+ #
559
720
  # === Loofah::Scrubbers::NoOpener / scrub!(:noopener)
560
721
  #
561
722
  # +:noopener+ adds a rel="noopener" attribute to all links
562
723
  #
563
724
  # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
564
- # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
725
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noopener)
565
726
  # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
566
727
  #
728
+ # === Loofah::Scrubbers::NoReferrer / scrub!(:noreferrer)
729
+ #
730
+ # +:noreferrer+ adds a rel="noreferrer" attribute to all links
731
+ #
732
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
733
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noreferrer)
734
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noreferrer">I like your blog post</a>"
735
+ #
567
736
  #
568
737
  # === Loofah::Scrubbers::Unprintable / scrub!(:unprintable)
569
738
  #
570
739
  # +:unprintable+ removes unprintable Unicode characters.
571
740
  #
572
741
  # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
573
- # Loofah.fragment(markup).scrub!(:unprintable)
742
+ # Loofah.html5_fragment(markup).scrub!(:unprintable)
574
743
  # => "<p>Some text with an unprintable character at the end</p>"
575
744
  #
576
745
  # You may not be able to see the unprintable character in the above example, but there is a
@@ -579,50 +748,74 @@ class Loofah::ScrubberNotFound < ::RuntimeError; end
579
748
  #
580
749
  # http://timelessrepo.com/json-isnt-a-javascript-subset
581
750
  #
582
- # source://loofah//lib/loofah/scrubbers.rb#86
751
+ # source://loofah//lib/loofah/scrubbers.rb#104
583
752
  module Loofah::Scrubbers
584
753
  class << self
585
754
  # Returns an array of symbols representing the built-in scrubbers
586
755
  #
587
- # source://loofah//lib/loofah/scrubbers.rb#299
756
+ # source://loofah//lib/loofah/scrubbers.rb#425
588
757
  def scrubber_symbols; end
589
758
  end
590
759
  end
591
760
 
761
+ # === scrub!(:double_breakpoint)
762
+ #
763
+ # +:double_breakpoint+ replaces double-break tags with closing/opening paragraph tags.
764
+ #
765
+ # markup = "<p>Some text here in a logical paragraph.<br><br>Some more text, apparently a second paragraph.</p>"
766
+ # Loofah.html5_fragment(markup).scrub!(:double_breakpoint)
767
+ # => "<p>Some text here in a logical paragraph.</p><p>Some more text, apparently a second paragraph.</p>"
768
+ #
769
+ # source://loofah//lib/loofah/scrubbers.rb#362
770
+ class Loofah::Scrubbers::DoubleBreakpoint < ::Loofah::Scrubber
771
+ # @return [DoubleBreakpoint] a new instance of DoubleBreakpoint
772
+ #
773
+ # source://loofah//lib/loofah/scrubbers.rb#363
774
+ def initialize; end
775
+
776
+ # source://loofah//lib/loofah/scrubbers.rb#367
777
+ def scrub(node); end
778
+
779
+ private
780
+
781
+ # source://loofah//lib/loofah/scrubbers.rb#400
782
+ def remove_blank_text_nodes(node); end
783
+ end
784
+
592
785
  # === scrub!(:escape)
593
786
  #
594
787
  # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
595
788
  #
596
789
  # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
597
- # Loofah.fragment(unsafe_html).scrub!(:escape)
790
+ # Loofah.html5_fragment(unsafe_html).scrub!(:escape)
598
791
  # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
599
792
  #
600
- # source://loofah//lib/loofah/scrubbers.rb#143
793
+ # source://loofah//lib/loofah/scrubbers.rb#159
601
794
  class Loofah::Scrubbers::Escape < ::Loofah::Scrubber
602
795
  # @return [Escape] a new instance of Escape
603
796
  #
604
- # source://loofah//lib/loofah/scrubbers.rb#144
797
+ # source://loofah//lib/loofah/scrubbers.rb#160
605
798
  def initialize; end
606
799
 
607
- # source://loofah//lib/loofah/scrubbers.rb#148
800
+ # source://loofah//lib/loofah/scrubbers.rb#164
608
801
  def scrub(node); end
609
802
  end
610
803
 
611
804
  # A hash that maps a symbol (like +:prune+) to the appropriate Scrubber (Loofah::Scrubbers::Prune).
612
805
  #
613
- # source://loofah//lib/loofah/scrubbers.rb#285
806
+ # source://loofah//lib/loofah/scrubbers.rb#407
614
807
  Loofah::Scrubbers::MAP = T.let(T.unsafe(nil), Hash)
615
808
 
616
809
  # This class probably isn't useful publicly, but is used for #to_text's current implemention
617
810
  #
618
- # source://loofah//lib/loofah/scrubbers.rb#237
811
+ # source://loofah//lib/loofah/scrubbers.rb#307
619
812
  class Loofah::Scrubbers::NewlineBlockElements < ::Loofah::Scrubber
620
813
  # @return [NewlineBlockElements] a new instance of NewlineBlockElements
621
814
  #
622
- # source://loofah//lib/loofah/scrubbers.rb#238
815
+ # source://loofah//lib/loofah/scrubbers.rb#308
623
816
  def initialize; end
624
817
 
625
- # source://loofah//lib/loofah/scrubbers.rb#242
818
+ # source://loofah//lib/loofah/scrubbers.rb#312
626
819
  def scrub(node); end
627
820
  end
628
821
 
@@ -631,17 +824,17 @@ end
631
824
  # +:nofollow+ adds a rel="nofollow" attribute to all links
632
825
  #
633
826
  # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
634
- # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
827
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:nofollow)
635
828
  # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
636
829
  #
637
- # source://loofah//lib/loofah/scrubbers.rb#203
830
+ # source://loofah//lib/loofah/scrubbers.rb#220
638
831
  class Loofah::Scrubbers::NoFollow < ::Loofah::Scrubber
639
832
  # @return [NoFollow] a new instance of NoFollow
640
833
  #
641
- # source://loofah//lib/loofah/scrubbers.rb#204
834
+ # source://loofah//lib/loofah/scrubbers.rb#221
642
835
  def initialize; end
643
836
 
644
- # source://loofah//lib/loofah/scrubbers.rb#208
837
+ # source://loofah//lib/loofah/scrubbers.rb#225
645
838
  def scrub(node); end
646
839
  end
647
840
 
@@ -650,17 +843,36 @@ end
650
843
  # +:noopener+ adds a rel="noopener" attribute to all links
651
844
  #
652
845
  # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
653
- # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
846
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noopener)
654
847
  # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
655
848
  #
656
- # source://loofah//lib/loofah/scrubbers.rb#224
849
+ # source://loofah//lib/loofah/scrubbers.rb#271
657
850
  class Loofah::Scrubbers::NoOpener < ::Loofah::Scrubber
658
851
  # @return [NoOpener] a new instance of NoOpener
659
852
  #
660
- # source://loofah//lib/loofah/scrubbers.rb#225
853
+ # source://loofah//lib/loofah/scrubbers.rb#272
661
854
  def initialize; end
662
855
 
663
- # source://loofah//lib/loofah/scrubbers.rb#229
856
+ # source://loofah//lib/loofah/scrubbers.rb#276
857
+ def scrub(node); end
858
+ end
859
+
860
+ # === scrub!(:noreferrer)
861
+ #
862
+ # +:noreferrer+ adds a rel="noreferrer" attribute to all links
863
+ #
864
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
865
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noreferrer)
866
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noreferrer">I like your blog post</a>"
867
+ #
868
+ # source://loofah//lib/loofah/scrubbers.rb#293
869
+ class Loofah::Scrubbers::NoReferrer < ::Loofah::Scrubber
870
+ # @return [NoReferrer] a new instance of NoReferrer
871
+ #
872
+ # source://loofah//lib/loofah/scrubbers.rb#294
873
+ def initialize; end
874
+
875
+ # source://loofah//lib/loofah/scrubbers.rb#298
664
876
  def scrub(node); end
665
877
  end
666
878
 
@@ -669,17 +881,17 @@ end
669
881
  # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
670
882
  #
671
883
  # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
672
- # Loofah.fragment(unsafe_html).scrub!(:prune)
884
+ # Loofah.html5_fragment(unsafe_html).scrub!(:prune)
673
885
  # => "ohai! <div>div is safe</div> "
674
886
  #
675
- # source://loofah//lib/loofah/scrubbers.rb#122
887
+ # source://loofah//lib/loofah/scrubbers.rb#137
676
888
  class Loofah::Scrubbers::Prune < ::Loofah::Scrubber
677
889
  # @return [Prune] a new instance of Prune
678
890
  #
679
- # source://loofah//lib/loofah/scrubbers.rb#123
891
+ # source://loofah//lib/loofah/scrubbers.rb#138
680
892
  def initialize; end
681
893
 
682
- # source://loofah//lib/loofah/scrubbers.rb#127
894
+ # source://loofah//lib/loofah/scrubbers.rb#142
683
895
  def scrub(node); end
684
896
  end
685
897
 
@@ -688,17 +900,40 @@ end
688
900
  # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
689
901
  #
690
902
  # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
691
- # Loofah.fragment(unsafe_html).scrub!(:strip)
903
+ # Loofah.html5_fragment(unsafe_html).scrub!(:strip)
692
904
  # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
693
905
  #
694
- # source://loofah//lib/loofah/scrubbers.rb#96
906
+ # source://loofah//lib/loofah/scrubbers.rb#114
695
907
  class Loofah::Scrubbers::Strip < ::Loofah::Scrubber
696
908
  # @return [Strip] a new instance of Strip
697
909
  #
698
- # source://loofah//lib/loofah/scrubbers.rb#97
910
+ # source://loofah//lib/loofah/scrubbers.rb#115
911
+ def initialize; end
912
+
913
+ # source://loofah//lib/loofah/scrubbers.rb#119
914
+ def scrub(node); end
915
+ end
916
+
917
+ # === scrub!(:targetblank)
918
+ #
919
+ # +:targetblank+ adds a target="_blank" attribute to all links.
920
+ # If there is a target already set, replaces it with target="_blank".
921
+ #
922
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
923
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:targetblank)
924
+ # => "ohai! <a href='http://www.myswarmysite.com/' target="_blank">I like your blog post</a>"
925
+ #
926
+ # On modern browsers, setting target="_blank" on anchor elements implicitly provides the same
927
+ # behavior as setting rel="noopener".
928
+ #
929
+ # source://loofah//lib/loofah/scrubbers.rb#246
930
+ class Loofah::Scrubbers::TargetBlank < ::Loofah::Scrubber
931
+ # @return [TargetBlank] a new instance of TargetBlank
932
+ #
933
+ # source://loofah//lib/loofah/scrubbers.rb#247
699
934
  def initialize; end
700
935
 
701
- # source://loofah//lib/loofah/scrubbers.rb#101
936
+ # source://loofah//lib/loofah/scrubbers.rb#251
702
937
  def scrub(node); end
703
938
  end
704
939
 
@@ -707,7 +942,7 @@ end
707
942
  # +:unprintable+ removes unprintable Unicode characters.
708
943
  #
709
944
  # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
710
- # Loofah.fragment(markup).scrub!(:unprintable)
945
+ # Loofah.html5_fragment(markup).scrub!(:unprintable)
711
946
  # => "<p>Some text with an unprintable character at the end</p>"
712
947
  #
713
948
  # You may not be able to see the unprintable character in the above example, but there is a
@@ -716,14 +951,14 @@ end
716
951
  #
717
952
  # http://timelessrepo.com/json-isnt-a-javascript-subset
718
953
  #
719
- # source://loofah//lib/loofah/scrubbers.rb#269
954
+ # source://loofah//lib/loofah/scrubbers.rb#340
720
955
  class Loofah::Scrubbers::Unprintable < ::Loofah::Scrubber
721
956
  # @return [Unprintable] a new instance of Unprintable
722
957
  #
723
- # source://loofah//lib/loofah/scrubbers.rb#270
958
+ # source://loofah//lib/loofah/scrubbers.rb#341
724
959
  def initialize; end
725
960
 
726
- # source://loofah//lib/loofah/scrubbers.rb#274
961
+ # source://loofah//lib/loofah/scrubbers.rb#345
727
962
  def scrub(node); end
728
963
  end
729
964
 
@@ -735,7 +970,7 @@ end
735
970
  # layer of paint on top of the HTML input to make it look nice.
736
971
  #
737
972
  # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
738
- # Loofah.fragment(messy_markup).scrub!(:whitewash)
973
+ # Loofah.html5_fragment(messy_markup).scrub!(:whitewash)
739
974
  # => "ohai! <div>div with attributes</div>"
740
975
  #
741
976
  # One use case for this scrubber is to clean up HTML that was
@@ -744,117 +979,113 @@ end
744
979
  # all kinds of cruft into its HTML output. Who needs that crap?
745
980
  # Certainly not me.
746
981
  #
747
- # source://loofah//lib/loofah/scrubbers.rb#174
982
+ # source://loofah//lib/loofah/scrubbers.rb#191
748
983
  class Loofah::Scrubbers::Whitewash < ::Loofah::Scrubber
749
984
  # @return [Whitewash] a new instance of Whitewash
750
985
  #
751
- # source://loofah//lib/loofah/scrubbers.rb#175
986
+ # source://loofah//lib/loofah/scrubbers.rb#192
752
987
  def initialize; end
753
988
 
754
- # source://loofah//lib/loofah/scrubbers.rb#179
989
+ # source://loofah//lib/loofah/scrubbers.rb#196
755
990
  def scrub(node); end
756
991
  end
757
992
 
758
- # Overrides +text+ in HTML::Document and HTML::DocumentFragment,
759
- # and mixes in +to_text+.
993
+ # Overrides +text+ in Document and DocumentFragment classes, and mixes in +to_text+.
760
994
  #
761
- # source://loofah//lib/loofah/instance_methods.rb#73
995
+ # source://loofah//lib/loofah/concerns.rb#73
762
996
  module Loofah::TextBehavior
763
- # Returns a plain-text version of the markup contained by the document,
764
- # with HTML entities encoded.
997
+ # Returns a plain-text version of the markup contained by the document, with HTML entities
998
+ # encoded.
765
999
  #
766
- # This method is significantly faster than #to_text, but isn't
767
- # clever about whitespace around block elements.
1000
+ # This method is significantly faster than #to_text, but isn't clever about whitespace around
1001
+ # block elements.
768
1002
  #
769
- # Loofah.document("<h1>Title</h1><div>Content</div>").text
1003
+ # Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
770
1004
  # # => "TitleContent"
771
1005
  #
772
- # By default, the returned text will have HTML entities
773
- # escaped. If you want unescaped entities, and you understand
774
- # that the result is unsafe to render in a browser, then you
775
- # can pass an argument as shown:
1006
+ # By default, the returned text will have HTML entities escaped. If you want unescaped
1007
+ # entities, and you understand that the result is unsafe to render in a browser, then you can
1008
+ # pass an argument as shown:
776
1009
  #
777
- # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
1010
+ # frag = Loofah.html5_fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
778
1011
  # # ok for browser:
779
1012
  # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
780
1013
  # # decidedly not ok for browser:
781
1014
  # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
782
1015
  #
783
- # source://loofah//lib/loofah/instance_methods.rb#95
1016
+ # source://loofah//lib/loofah/concerns.rb#94
784
1017
  def inner_text(options = T.unsafe(nil)); end
785
1018
 
786
- # Returns a plain-text version of the markup contained by the document,
787
- # with HTML entities encoded.
1019
+ # Returns a plain-text version of the markup contained by the document, with HTML entities
1020
+ # encoded.
788
1021
  #
789
- # This method is significantly faster than #to_text, but isn't
790
- # clever about whitespace around block elements.
1022
+ # This method is significantly faster than #to_text, but isn't clever about whitespace around
1023
+ # block elements.
791
1024
  #
792
- # Loofah.document("<h1>Title</h1><div>Content</div>").text
1025
+ # Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
793
1026
  # # => "TitleContent"
794
1027
  #
795
- # By default, the returned text will have HTML entities
796
- # escaped. If you want unescaped entities, and you understand
797
- # that the result is unsafe to render in a browser, then you
798
- # can pass an argument as shown:
1028
+ # By default, the returned text will have HTML entities escaped. If you want unescaped
1029
+ # entities, and you understand that the result is unsafe to render in a browser, then you can
1030
+ # pass an argument as shown:
799
1031
  #
800
- # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
1032
+ # frag = Loofah.html5_fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
801
1033
  # # ok for browser:
802
1034
  # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
803
1035
  # # decidedly not ok for browser:
804
1036
  # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
805
1037
  #
806
- # source://loofah//lib/loofah/instance_methods.rb#95
1038
+ # source://loofah//lib/loofah/concerns.rb#94
807
1039
  def text(options = T.unsafe(nil)); end
808
1040
 
809
- # Returns a plain-text version of the markup contained by the document,
810
- # with HTML entities encoded.
1041
+ # Returns a plain-text version of the markup contained by the document, with HTML entities
1042
+ # encoded.
811
1043
  #
812
- # This method is significantly faster than #to_text, but isn't
813
- # clever about whitespace around block elements.
1044
+ # This method is significantly faster than #to_text, but isn't clever about whitespace around
1045
+ # block elements.
814
1046
  #
815
- # Loofah.document("<h1>Title</h1><div>Content</div>").text
1047
+ # Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
816
1048
  # # => "TitleContent"
817
1049
  #
818
- # By default, the returned text will have HTML entities
819
- # escaped. If you want unescaped entities, and you understand
820
- # that the result is unsafe to render in a browser, then you
821
- # can pass an argument as shown:
1050
+ # By default, the returned text will have HTML entities escaped. If you want unescaped
1051
+ # entities, and you understand that the result is unsafe to render in a browser, then you can
1052
+ # pass an argument as shown:
822
1053
  #
823
- # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
1054
+ # frag = Loofah.html5_fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
824
1055
  # # ok for browser:
825
1056
  # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
826
1057
  # # decidedly not ok for browser:
827
1058
  # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
828
1059
  #
829
- # source://loofah//lib/loofah/instance_methods.rb#95
1060
+ # source://loofah//lib/loofah/concerns.rb#94
830
1061
  def to_str(options = T.unsafe(nil)); end
831
1062
 
832
- # Returns a plain-text version of the markup contained by the
833
- # fragment, with HTML entities encoded.
1063
+ # Returns a plain-text version of the markup contained by the fragment, with HTML entities
1064
+ # encoded.
834
1065
  #
835
- # This method is slower than #text, but is clever about
836
- # whitespace around block elements and line break elements.
1066
+ # This method is slower than #text, but is clever about whitespace around block elements and
1067
+ # line break elements.
837
1068
  #
838
- # Loofah.document("<h1>Title</h1><div>Content<br>Next line</div>").to_text
1069
+ # Loofah.html5_document("<h1>Title</h1><div>Content<br>Next line</div>").to_text
839
1070
  # # => "\nTitle\n\nContent\nNext line\n"
840
1071
  #
841
- # source://loofah//lib/loofah/instance_methods.rb#121
1072
+ # source://loofah//lib/loofah/concerns.rb#120
842
1073
  def to_text(options = T.unsafe(nil)); end
843
1074
  end
844
1075
 
845
1076
  # The version of Loofah you are using
846
1077
  #
847
- # source://loofah//lib/loofah/version.rb#4
1078
+ # source://loofah//lib/loofah/version.rb#5
848
1079
  Loofah::VERSION = T.let(T.unsafe(nil), String)
849
1080
 
850
- # source://loofah//lib/loofah/xml/document.rb#3
1081
+ # source://loofah//lib/loofah/xml/document.rb#4
851
1082
  module Loofah::XML; end
852
1083
 
853
1084
  # Subclass of Nokogiri::XML::Document.
854
1085
  #
855
1086
  # See Loofah::ScrubBehavior and Loofah::DocumentDecorator for additional methods.
856
1087
  #
857
- # source://loofah//lib/loofah/xml/document.rb#9
1088
+ # source://loofah//lib/loofah/xml/document.rb#10
858
1089
  class Loofah::XML::Document < ::Nokogiri::XML::Document
859
1090
  include ::Loofah::ScrubBehavior::Node
860
1091
  include ::Loofah::DocumentDecorator
@@ -864,14 +1095,10 @@ end
864
1095
  #
865
1096
  # See Loofah::ScrubBehavior for additional methods.
866
1097
  #
867
- # source://loofah//lib/loofah/xml/document_fragment.rb#9
1098
+ # source://loofah//lib/loofah/xml/document_fragment.rb#10
868
1099
  class Loofah::XML::DocumentFragment < ::Nokogiri::XML::DocumentFragment
869
1100
  class << self
870
- # Overridden Nokogiri::XML::DocumentFragment
871
- # constructor. Applications should use Loofah.fragment to
872
- # parse a fragment.
873
- #
874
- # source://loofah//lib/loofah/xml/document_fragment.rb#16
1101
+ # source://loofah//lib/loofah/xml/document_fragment.rb#12
875
1102
  def parse(tags); end
876
1103
  end
877
1104
  end