nokogiri 1.13.10 → 1.14.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +33 -0
  3. data/LICENSE-DEPENDENCIES.md +830 -509
  4. data/README.md +18 -11
  5. data/dependencies.yml +25 -7
  6. data/ext/nokogiri/extconf.rb +79 -20
  7. data/ext/nokogiri/gumbo.c +19 -9
  8. data/ext/nokogiri/html4_document.c +1 -1
  9. data/ext/nokogiri/html4_entity_lookup.c +1 -1
  10. data/ext/nokogiri/html4_sax_parser_context.c +0 -5
  11. data/ext/nokogiri/nokogiri.c +32 -51
  12. data/ext/nokogiri/nokogiri.h +17 -14
  13. data/ext/nokogiri/xml_attribute_decl.c +1 -1
  14. data/ext/nokogiri/xml_cdata.c +1 -1
  15. data/ext/nokogiri/xml_document.c +16 -11
  16. data/ext/nokogiri/xml_element_content.c +2 -2
  17. data/ext/nokogiri/xml_element_decl.c +1 -1
  18. data/ext/nokogiri/xml_encoding_handler.c +2 -2
  19. data/ext/nokogiri/xml_namespace.c +38 -8
  20. data/ext/nokogiri/xml_node.c +286 -26
  21. data/ext/nokogiri/xml_node_set.c +0 -2
  22. data/ext/nokogiri/xml_reader.c +40 -20
  23. data/ext/nokogiri/xml_relax_ng.c +0 -2
  24. data/ext/nokogiri/xml_sax_parser.c +22 -16
  25. data/ext/nokogiri/xml_sax_parser_context.c +0 -5
  26. data/ext/nokogiri/xml_sax_push_parser.c +0 -2
  27. data/ext/nokogiri/xml_schema.c +0 -2
  28. data/ext/nokogiri/xml_xpath_context.c +87 -83
  29. data/ext/nokogiri/xslt_stylesheet.c +14 -13
  30. data/gumbo-parser/Makefile +10 -0
  31. data/gumbo-parser/src/attribute.h +1 -1
  32. data/gumbo-parser/src/error.c +1 -1
  33. data/gumbo-parser/src/error.h +1 -1
  34. data/gumbo-parser/src/foreign_attrs.c +2 -2
  35. data/gumbo-parser/src/{gumbo.h → nokogiri_gumbo.h} +1 -0
  36. data/gumbo-parser/src/parser.c +7 -4
  37. data/gumbo-parser/src/replacement.h +1 -1
  38. data/gumbo-parser/src/string_buffer.h +1 -1
  39. data/gumbo-parser/src/string_piece.c +1 -1
  40. data/gumbo-parser/src/svg_attrs.c +2 -2
  41. data/gumbo-parser/src/svg_tags.c +2 -2
  42. data/gumbo-parser/src/tag.c +2 -1
  43. data/gumbo-parser/src/tag_lookup.c +7 -7
  44. data/gumbo-parser/src/tag_lookup.gperf +1 -0
  45. data/gumbo-parser/src/tag_lookup.h +1 -1
  46. data/gumbo-parser/src/token_buffer.h +1 -1
  47. data/gumbo-parser/src/tokenizer.c +1 -1
  48. data/gumbo-parser/src/tokenizer.h +1 -1
  49. data/gumbo-parser/src/utf8.c +1 -1
  50. data/gumbo-parser/src/utf8.h +1 -1
  51. data/gumbo-parser/src/util.c +1 -3
  52. data/gumbo-parser/src/util.h +4 -0
  53. data/gumbo-parser/src/vector.h +1 -1
  54. data/lib/nokogiri/css/node.rb +2 -2
  55. data/lib/nokogiri/css/xpath_visitor.rb +3 -1
  56. data/lib/nokogiri/css.rb +6 -0
  57. data/lib/nokogiri/encoding_handler.rb +57 -0
  58. data/lib/nokogiri/extension.rb +3 -2
  59. data/lib/nokogiri/html4/document.rb +2 -121
  60. data/lib/nokogiri/html4/element_description_defaults.rb +6 -12
  61. data/lib/nokogiri/html4/encoding_reader.rb +121 -0
  62. data/lib/nokogiri/html4.rb +1 -0
  63. data/lib/nokogiri/html5/document.rb +113 -36
  64. data/lib/nokogiri/html5/document_fragment.rb +9 -2
  65. data/lib/nokogiri/html5/node.rb +3 -5
  66. data/lib/nokogiri/html5.rb +127 -216
  67. data/lib/nokogiri/jruby/dependencies.rb +1 -19
  68. data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
  69. data/lib/nokogiri/version/constant.rb +1 -1
  70. data/lib/nokogiri/version/info.rb +11 -10
  71. data/lib/nokogiri/xml/attr.rb +49 -0
  72. data/lib/nokogiri/xml/builder.rb +1 -1
  73. data/lib/nokogiri/xml/document.rb +102 -54
  74. data/lib/nokogiri/xml/document_fragment.rb +49 -6
  75. data/lib/nokogiri/xml/namespace.rb +42 -0
  76. data/lib/nokogiri/xml/node/save_options.rb +4 -2
  77. data/lib/nokogiri/xml/node.rb +190 -35
  78. data/lib/nokogiri/xml/node_set.rb +87 -9
  79. data/lib/nokogiri/xml/parse_options.rb +127 -48
  80. data/lib/nokogiri/xml/pp/node.rb +6 -4
  81. data/lib/nokogiri/xml/processing_instruction.rb +2 -1
  82. data/lib/nokogiri/xml/sax/parser.rb +2 -3
  83. data/lib/nokogiri/xslt.rb +1 -1
  84. data/lib/nokogiri.rb +3 -11
  85. metadata +11 -247
  86. data/patches/libxml2/0005-avoid-isnan-isinf.patch +0 -81
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Nokogiri
@@ -201,7 +202,7 @@ module Nokogiri
201
202
  #
202
203
  def attr(key, value = nil, &block)
203
204
  unless key.is_a?(Hash) || (key && (value || block))
204
- return first ? first.attribute(key) : nil
205
+ return first&.attribute(key)
205
206
  end
206
207
 
207
208
  hash = key.is_a?(Hash) ? key : { key => value }
@@ -260,10 +261,73 @@ module Nokogiri
260
261
  collect { |j| j.inner_html(*args) }.join("")
261
262
  end
262
263
 
263
- ###
264
- # Wrap this NodeSet with +html+
265
- def wrap(html)
266
- map { |node| node.wrap(html) }
264
+ # :call-seq:
265
+ # wrap(markup) -> self
266
+ # wrap(node) -> self
267
+ #
268
+ # Wrap each member of this NodeSet with the node parsed from +markup+ or a dup of the +node+.
269
+ #
270
+ # [Parameters]
271
+ # - *markup* (String)
272
+ # Markup that is parsed, once per member of the NodeSet, and used as the wrapper. Each
273
+ # node's parent, if it exists, is used as the context node for parsing; otherwise the
274
+ # associated document is used. If the parsed fragment has multiple roots, the first root
275
+ # node is used as the wrapper.
276
+ # - *node* (Nokogiri::XML::Node)
277
+ # An element that is `#dup`ed and used as the wrapper.
278
+ #
279
+ # [Returns] +self+, to support chaining.
280
+ #
281
+ # ⚠ Note that if a +String+ is passed, the markup will be parsed <b>once per node</b> in the
282
+ # NodeSet. You can avoid this overhead in cases where you know exactly the wrapper you wish to
283
+ # use by passing a +Node+ instead.
284
+ #
285
+ # Also see Node#wrap
286
+ #
287
+ # *Example* with a +String+ argument:
288
+ #
289
+ # doc = Nokogiri::HTML5(<<~HTML)
290
+ # <html><body>
291
+ # <a>a</a>
292
+ # <a>b</a>
293
+ # <a>c</a>
294
+ # <a>d</a>
295
+ # </body></html>
296
+ # HTML
297
+ # doc.css("a").wrap("<div></div>")
298
+ # doc.to_html
299
+ # # => <html><head></head><body>
300
+ # # <div><a>a</a></div>
301
+ # # <div><a>b</a></div>
302
+ # # <div><a>c</a></div>
303
+ # # <div><a>d</a></div>
304
+ # # </body></html>
305
+ #
306
+ # *Example* with a +Node+ argument
307
+ #
308
+ # 💡 Note that this is faster than the equivalent call passing a +String+ because it avoids
309
+ # having to reparse the wrapper markup for each node.
310
+ #
311
+ # doc = Nokogiri::HTML5(<<~HTML)
312
+ # <html><body>
313
+ # <a>a</a>
314
+ # <a>b</a>
315
+ # <a>c</a>
316
+ # <a>d</a>
317
+ # </body></html>
318
+ # HTML
319
+ # doc.css("a").wrap(doc.create_element("div"))
320
+ # doc.to_html
321
+ # # => <html><head></head><body>
322
+ # # <div><a>a</a></div>
323
+ # # <div><a>b</a></div>
324
+ # # <div><a>c</a></div>
325
+ # # <div><a>d</a></div>
326
+ # # </body></html>
327
+ #
328
+ def wrap(node_or_tags)
329
+ map { |node| node.wrap(node_or_tags) }
330
+ self
267
331
  end
268
332
 
269
333
  ###
@@ -277,12 +341,15 @@ module Nokogiri
277
341
  def to_html(*args)
278
342
  if Nokogiri.jruby?
279
343
  options = args.first.is_a?(Hash) ? args.shift : {}
280
- unless options[:save_with]
281
- options[:save_with] = Node::SaveOptions::NO_DECLARATION | Node::SaveOptions::NO_EMPTY_TAGS | Node::SaveOptions::AS_HTML
282
- end
344
+ options[:save_with] ||= Node::SaveOptions::DEFAULT_HTML
283
345
  args.insert(0, options)
284
346
  end
285
- map { |x| x.to_html(*args) }.join
347
+ if empty?
348
+ encoding = (args.first.is_a?(Hash) ? args.first[:encoding] : nil) || document.encoding
349
+ "".encode(encoding)
350
+ else
351
+ map { |x| x.to_html(*args) }.join
352
+ end
286
353
  end
287
354
 
288
355
  ###
@@ -362,6 +429,17 @@ module Nokogiri
362
429
 
363
430
  alias_method :+, :|
364
431
 
432
+ #
433
+ # :call-seq: deconstruct() → Array
434
+ #
435
+ # Returns the members of this NodeSet as an array, to use in pattern matching.
436
+ #
437
+ # ⚡ This is an experimental feature, available since v1.14.0
438
+ #
439
+ def deconstruct
440
+ to_a
441
+ end
442
+
365
443
  IMPLIED_XPATH_CONTEXTS = [".//", "self::"].freeze # :nodoc:
366
444
  end
367
445
  end
@@ -1,84 +1,163 @@
1
+ # coding: utf-8
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Nokogiri
4
5
  module XML
5
- ###
6
- # Parse options for passing to Nokogiri.XML or Nokogiri.HTML
7
- #
8
- # == Building combinations of parse options
9
- # You can build your own combinations of these parse options by using any of the following methods:
10
- # *Note*: All examples attempt to set the +RECOVER+ & +NOENT+ options.
11
- # [Ruby's bitwise operators] You can use the Ruby bitwise operators to set various combinations.
12
- # Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new((1 << 0) | (1 << 1)))
13
- # [Method chaining] Every option has an equivalent method in lowercase. You can chain these methods together to set various combinations.
14
- # Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new.recover.noent)
15
- # [Using Ruby Blocks] You can also setup parse combinations in the block passed to Nokogiri.XML or Nokogiri.HTML
16
- # Nokogiri.XML('<content>Chapter 1</content') {|config| config.recover.noent}
17
- #
18
- # == Removing particular parse options
19
- # You can also remove options from an instance of +ParseOptions+ dynamically.
20
- # Every option has an equivalent <code>no{option}</code> method in lowercase. You can call these methods on an instance of +ParseOptions+ to remove the option.
21
- # Note that this is not available for +STRICT+.
22
- #
23
- # # Setting the RECOVER & NOENT options...
24
- # options = Nokogiri::XML::ParseOptions.new.recover.noent
25
- # # later...
26
- # options.norecover # Removes the Nokogiri::XML::ParseOptions::RECOVER option
27
- # options.nonoent # Removes the Nokogiri::XML::ParseOptions::NOENT option
6
+ # Options that control the parsing behavior for XML::Document, XML::DocumentFragment,
7
+ # HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema.
8
+ #
9
+ # These options directly expose libxml2's parse options, which are all boolean in the sense that
10
+ # an option is "on" or "off".
11
+ #
12
+ # 💡 Note that HTML5 parsing has a separate, orthogonal set of options due to the nature of the
13
+ # HTML5 specification. See Nokogiri::HTML5.
14
+ #
15
+ # ⚠ Not all parse options are supported on JRuby. Nokogiri will attempt to invoke the equivalent
16
+ # behavior in Xerces/NekoHTML on JRuby when it's possible.
17
+ #
18
+ # == Setting and unsetting parse options
19
+ #
20
+ # You can build your own combinations of parse options by using any of the following methods:
21
+ #
22
+ # [ParseOptions method chaining]
23
+ #
24
+ # Every option has an equivalent method in lowercase. You can chain these methods together to
25
+ # set various combinations.
26
+ #
27
+ # # Set the HUGE & PEDANTIC options
28
+ # po = Nokogiri::XML::ParseOptions.new.huge.pedantic
29
+ # doc = Nokogiri::XML::Document.parse(xml, nil, nil, po)
30
+ #
31
+ # Every option has an equivalent <code>no{option}</code> method in lowercase. You can call these
32
+ # methods on an instance of ParseOptions to unset the option.
33
+ #
34
+ # # Set the HUGE & PEDANTIC options
35
+ # po = Nokogiri::XML::ParseOptions.new.huge.pedantic
36
+ #
37
+ # # later we want to modify the options
38
+ # po.nohuge # Unset the HUGE option
39
+ # po.nopedantic # Unset the PEDANTIC option
40
+ #
41
+ # 💡 Note that some options begin with "no" leading to the logical but perhaps unintuitive
42
+ # double negative:
43
+ #
44
+ # po.nocdata # Set the NOCDATA parse option
45
+ # po.nonocdata # Unset the NOCDATA parse option
46
+ #
47
+ # 💡 Note that negation is not available for STRICT, which is itself a negation of all other
48
+ # features.
49
+ #
50
+ #
51
+ # [Using Ruby Blocks]
52
+ #
53
+ # Most parsing methods will accept a block for configuration of parse options, and we
54
+ # recommend chaining the setter methods:
55
+ #
56
+ # doc = Nokogiri::XML::Document.parse(xml) { |config| config.huge.pedantic }
57
+ #
58
+ #
59
+ # [ParseOptions constants]
60
+ #
61
+ # You can also use the constants declared under Nokogiri::XML::ParseOptions to set various
62
+ # combinations. They are bits in a bitmask, and so can be combined with bitwise operators:
63
+ #
64
+ # po = Nokogiri::XML::ParseOptions.new(Nokogiri::XML::ParseOptions::HUGE | Nokogiri::XML::ParseOptions::PEDANTIC)
65
+ # doc = Nokogiri::XML::Document.parse(xml, nil, nil, po)
28
66
  #
29
67
  class ParseOptions
30
68
  # Strict parsing
31
69
  STRICT = 0
32
- # Recover from errors
70
+
71
+ # Recover from errors. On by default for XML::Document, XML::DocumentFragment,
72
+ # HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema.
33
73
  RECOVER = 1 << 0
34
- # Substitute entities
74
+
75
+ # Substitute entities. Off by default.
76
+ #
77
+ # ⚠ This option enables entity substitution, contrary to what the name implies.
78
+ #
79
+ # ⚠ <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
35
80
  NOENT = 1 << 1
36
- # Load external subsets
81
+
82
+ # Load external subsets. On by default for XSLT::Stylesheet.
83
+ #
84
+ # ⚠ <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
37
85
  DTDLOAD = 1 << 2
38
- # Default DTD attributes
86
+
87
+ # Default DTD attributes. On by default for XSLT::Stylesheet.
39
88
  DTDATTR = 1 << 3
40
- # validate with the DTD
89
+
90
+ # Validate with the DTD. Off by default.
41
91
  DTDVALID = 1 << 4
42
- # suppress error reports
92
+
93
+ # Suppress error reports. On by default for HTML4::Document and HTML4::DocumentFragment
43
94
  NOERROR = 1 << 5
44
- # suppress warning reports
95
+
96
+ # Suppress warning reports. On by default for HTML4::Document and HTML4::DocumentFragment
45
97
  NOWARNING = 1 << 6
46
- # pedantic error reporting
98
+
99
+ # Enable pedantic error reporting. Off by default.
47
100
  PEDANTIC = 1 << 7
48
- # remove blank nodes
101
+
102
+ # Remove blank nodes. Off by default.
49
103
  NOBLANKS = 1 << 8
50
- # use the SAX1 interface internally
104
+
105
+ # Use the SAX1 interface internally. Off by default.
51
106
  SAX1 = 1 << 9
52
- # Implement XInclude substitution
107
+
108
+ # Implement XInclude substitution. Off by default.
53
109
  XINCLUDE = 1 << 10
54
- # Forbid network access. Recommended for dealing with untrusted documents.
110
+
111
+ # Forbid network access. On by default for XML::Document, XML::DocumentFragment,
112
+ # HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema.
113
+ #
114
+ # ⚠ <b>It is UNSAFE to unset this option</b> when parsing untrusted documents.
55
115
  NONET = 1 << 11
56
- # Do not reuse the context dictionary
116
+
117
+ # Do not reuse the context dictionary. Off by default.
57
118
  NODICT = 1 << 12
58
- # remove redundant namespaces declarations
119
+
120
+ # Remove redundant namespaces declarations. Off by default.
59
121
  NSCLEAN = 1 << 13
60
- # merge CDATA as text nodes
122
+
123
+ # Merge CDATA as text nodes. On by default for XSLT::Stylesheet.
61
124
  NOCDATA = 1 << 14
62
- # do not generate XINCLUDE START/END nodes
125
+
126
+ # Do not generate XInclude START/END nodes. Off by default.
63
127
  NOXINCNODE = 1 << 15
64
- # compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree)
128
+
129
+ # Compact small text nodes. Off by default.
130
+ #
131
+ # ⚠ No modification of the DOM tree is allowed after parsing. libxml2 may crash if you try to
132
+ # modify the tree.
65
133
  COMPACT = 1 << 16
66
- # parse using XML-1.0 before update 5
134
+
135
+ # Parse using XML-1.0 before update 5. Off by default
67
136
  OLD10 = 1 << 17
68
- # do not fixup XINCLUDE xml:base uris
137
+
138
+ # Do not fixup XInclude xml:base uris. Off by default
69
139
  NOBASEFIX = 1 << 18
70
- # relax any hardcoded limit from the parser
140
+
141
+ # Relax any hardcoded limit from the parser. Off by default.
142
+ #
143
+ # ⚠ There may be a performance penalty when this option is set.
71
144
  HUGE = 1 << 19
72
- # line numbers stored as long int (instead of a short int)
145
+
146
+ # Support line numbers up to <code>long int</code> (default is a <code>short int</code>). On
147
+ # by default for for XML::Document, XML::DocumentFragment, HTML4::Document,
148
+ # HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema.
73
149
  BIG_LINES = 1 << 22
74
150
 
75
- # the default options used for parsing XML documents
151
+ # The options mask used by default for parsing XML::Document and XML::DocumentFragment
76
152
  DEFAULT_XML = RECOVER | NONET | BIG_LINES
77
- # the default options used for parsing XSLT stylesheets
153
+
154
+ # The options mask used by default used for parsing XSLT::Stylesheet
78
155
  DEFAULT_XSLT = RECOVER | NONET | NOENT | DTDLOAD | DTDATTR | NOCDATA | BIG_LINES
79
- # the default options used for parsing HTML documents
156
+
157
+ # The options mask used by default used for parsing HTML4::Document and HTML4::DocumentFragment
80
158
  DEFAULT_HTML = RECOVER | NOERROR | NOWARNING | NONET | BIG_LINES
81
- # the default options used for parsing XML schemas
159
+
160
+ # The options mask used by default used for parsing XML::Schema
82
161
  DEFAULT_SCHEMA = NONET | BIG_LINES
83
162
 
84
163
  attr_accessor :options
@@ -5,6 +5,8 @@ module Nokogiri
5
5
  # :nodoc: all
6
6
  module PP
7
7
  module Node
8
+ COLLECTIONS = [:attribute_nodes, :children]
9
+
8
10
  def inspect
9
11
  attributes = inspect_attributes.reject do |x|
10
12
  attribute = send(x)
@@ -21,11 +23,11 @@ module Nokogiri
21
23
  nice_name = self.class.name.split("::").last
22
24
  pp.group(2, "#(#{nice_name}:#{format("0x%x", object_id)} {", "})") do
23
25
  pp.breakable
24
- attrs = inspect_attributes.map do |t|
26
+ attrs = inspect_attributes.filter_map do |t|
25
27
  [t, send(t)] if respond_to?(t)
26
- end.compact.find_all do |x|
28
+ end.find_all do |x|
27
29
  if x.last
28
- if [:attribute_nodes, :children].include?(x.first)
30
+ if COLLECTIONS.include?(x.first)
29
31
  !x.last.empty?
30
32
  else
31
33
  true
@@ -34,7 +36,7 @@ module Nokogiri
34
36
  end
35
37
 
36
38
  pp.seplist(attrs) do |v|
37
- if [:attribute_nodes, :children].include?(v.first)
39
+ if COLLECTIONS.include?(v.first)
38
40
  pp.group(2, "#{v.first.to_s.sub(/_\w+$/, "s")} = [", "]") do
39
41
  pp.breakable
40
42
  pp.seplist(v.last) do |item|
@@ -3,7 +3,8 @@
3
3
  module Nokogiri
4
4
  module XML
5
5
  class ProcessingInstruction < Node
6
- def initialize(document, name, content) # rubocop:disable Style/RedundantInitialize
6
+ def initialize(document, name, content)
7
+ super(document, name)
7
8
  end
8
9
  end
9
10
  end
@@ -88,9 +88,8 @@ module Nokogiri
88
88
 
89
89
  ###
90
90
  # Parse given +io+
91
- def parse_io(io, encoding = "ASCII")
92
- @encoding = check_encoding(encoding)
93
- ctx = ParserContext.io(io, ENCODINGS[@encoding])
91
+ def parse_io(io, encoding = @encoding)
92
+ ctx = ParserContext.io(io, ENCODINGS[check_encoding(encoding)])
94
93
  yield ctx if block_given?
95
94
  ctx.parse_with(self)
96
95
  end
data/lib/nokogiri/xslt.rb CHANGED
@@ -47,7 +47,7 @@ module Nokogiri
47
47
  # [Returns] Array of string parameters, with quotes correctly escaped for use with XSLT::Stylesheet.transform
48
48
  #
49
49
  def quote_params(params)
50
- params.flatten.each_slice(2).each_with_object([]) do |kv, quoted_params|
50
+ params.flatten.each_slice(2).with_object([]) do |kv, quoted_params|
51
51
  key, value = kv.map(&:to_s)
52
52
  value = if /'/.match?(value)
53
53
  "concat('#{value.gsub(/'/, %q{', "'", '})}')"
data/lib/nokogiri.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require "rbconfig"
5
-
6
4
  if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
7
5
  require_relative "nokogiri/jruby/dependencies"
8
6
  end
@@ -88,17 +86,10 @@ module Nokogiri
88
86
 
89
87
  # :nodoc:
90
88
  def install_default_aliases
91
- # Make sure to support some popular encoding aliases not known by
92
- # all iconv implementations.
93
- {
94
- "Windows-31J" => "CP932", # Windows-31J is the IANA registered name of CP932.
95
- }.each do |alias_name, name|
96
- EncodingHandler.alias(name, alias_name) if EncodingHandler[alias_name].nil?
97
- end
89
+ warn("Nokogiri.install_default_aliases is deprecated and will be removed in a future version of Nokogiri. Please call Nokogiri::EncodingHandler.install_default_aliases instead.")
90
+ Nokogiri::EncodingHandler.install_default_aliases
98
91
  end
99
92
  end
100
-
101
- Nokogiri.install_default_aliases
102
93
  end
103
94
 
104
95
  ###
@@ -124,5 +115,6 @@ require_relative "nokogiri/html"
124
115
  require_relative "nokogiri/decorators/slop"
125
116
  require_relative "nokogiri/css"
126
117
  require_relative "nokogiri/html4/builder"
118
+ require_relative "nokogiri/encoding_handler"
127
119
 
128
120
  require_relative "nokogiri/html5" if Nokogiri.uses_gumbo?