nokogiri 1.8.5 → 1.9.1

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 (147) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/ext/nokogiri/extconf.rb +10 -6
  4. data/ext/nokogiri/xml_attr.c +26 -21
  5. data/ext/nokogiri/xml_document.c +4 -1
  6. data/ext/nokogiri/xml_namespace.c +3 -3
  7. data/ext/nokogiri/xml_namespace.h +1 -2
  8. data/ext/nokogiri/xml_node.c +55 -15
  9. data/lib/nokogiri/css/parser.rb +61 -61
  10. data/lib/nokogiri/version.rb +1 -1
  11. data/lib/nokogiri/xml/document_fragment.rb +11 -0
  12. data/lib/nokogiri/xml/node.rb +12 -0
  13. data/lib/nokogiri/xml/node_set.rb +4 -8
  14. metadata +17 -153
  15. data/.autotest +0 -22
  16. data/.cross_rubies +0 -8
  17. data/.editorconfig +0 -17
  18. data/.gemtest +0 -0
  19. data/.travis.yml +0 -63
  20. data/CHANGELOG.md +0 -1368
  21. data/CONTRIBUTING.md +0 -42
  22. data/C_CODING_STYLE.rdoc +0 -33
  23. data/Gemfile +0 -23
  24. data/Gemfile-libxml-ruby +0 -3
  25. data/Manifest.txt +0 -370
  26. data/ROADMAP.md +0 -111
  27. data/Rakefile +0 -348
  28. data/SECURITY.md +0 -19
  29. data/STANDARD_RESPONSES.md +0 -47
  30. data/Y_U_NO_GEMSPEC.md +0 -155
  31. data/appveyor.yml +0 -29
  32. data/build_all +0 -44
  33. data/patches/sort-patches-by-date +0 -25
  34. data/suppressions/README.txt +0 -1
  35. data/suppressions/nokogiri_ruby-2.supp +0 -10
  36. data/tasks/test.rb +0 -100
  37. data/test/css/test_nthiness.rb +0 -226
  38. data/test/css/test_parser.rb +0 -386
  39. data/test/css/test_tokenizer.rb +0 -215
  40. data/test/css/test_xpath_visitor.rb +0 -96
  41. data/test/decorators/test_slop.rb +0 -23
  42. data/test/files/2ch.html +0 -108
  43. data/test/files/GH_1042.html +0 -18
  44. data/test/files/address_book.rlx +0 -12
  45. data/test/files/address_book.xml +0 -10
  46. data/test/files/atom.xml +0 -344
  47. data/test/files/bar/bar.xsd +0 -4
  48. data/test/files/bogus.xml +0 -0
  49. data/test/files/dont_hurt_em_why.xml +0 -422
  50. data/test/files/encoding.html +0 -82
  51. data/test/files/encoding.xhtml +0 -84
  52. data/test/files/exslt.xml +0 -8
  53. data/test/files/exslt.xslt +0 -35
  54. data/test/files/foo/foo.xsd +0 -4
  55. data/test/files/metacharset.html +0 -10
  56. data/test/files/namespace_pressure_test.xml +0 -1684
  57. data/test/files/noencoding.html +0 -47
  58. data/test/files/po.xml +0 -32
  59. data/test/files/po.xsd +0 -66
  60. data/test/files/saml/saml20assertion_schema.xsd +0 -283
  61. data/test/files/saml/saml20protocol_schema.xsd +0 -302
  62. data/test/files/saml/xenc_schema.xsd +0 -146
  63. data/test/files/saml/xmldsig_schema.xsd +0 -318
  64. data/test/files/shift_jis.html +0 -10
  65. data/test/files/shift_jis.xml +0 -5
  66. data/test/files/shift_jis_no_charset.html +0 -9
  67. data/test/files/slow-xpath.xml +0 -25509
  68. data/test/files/snuggles.xml +0 -3
  69. data/test/files/staff.dtd +0 -10
  70. data/test/files/staff.xml +0 -59
  71. data/test/files/staff.xslt +0 -32
  72. data/test/files/test_document_url/bar.xml +0 -2
  73. data/test/files/test_document_url/document.dtd +0 -4
  74. data/test/files/test_document_url/document.xml +0 -6
  75. data/test/files/tlm.html +0 -851
  76. data/test/files/to_be_xincluded.xml +0 -2
  77. data/test/files/valid_bar.xml +0 -2
  78. data/test/files/xinclude.xml +0 -4
  79. data/test/helper.rb +0 -271
  80. data/test/html/sax/test_parser.rb +0 -168
  81. data/test/html/sax/test_parser_context.rb +0 -46
  82. data/test/html/sax/test_parser_text.rb +0 -163
  83. data/test/html/sax/test_push_parser.rb +0 -87
  84. data/test/html/test_attributes.rb +0 -85
  85. data/test/html/test_builder.rb +0 -164
  86. data/test/html/test_document.rb +0 -712
  87. data/test/html/test_document_encoding.rb +0 -143
  88. data/test/html/test_document_fragment.rb +0 -310
  89. data/test/html/test_element_description.rb +0 -105
  90. data/test/html/test_named_characters.rb +0 -14
  91. data/test/html/test_node.rb +0 -212
  92. data/test/html/test_node_encoding.rb +0 -91
  93. data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
  94. data/test/namespaces/test_namespaces_aliased_default.rb +0 -24
  95. data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
  96. data/test/namespaces/test_namespaces_in_cloned_doc.rb +0 -31
  97. data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
  98. data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -80
  99. data/test/namespaces/test_namespaces_preservation.rb +0 -31
  100. data/test/test_convert_xpath.rb +0 -135
  101. data/test/test_css_cache.rb +0 -47
  102. data/test/test_encoding_handler.rb +0 -48
  103. data/test/test_memory_leak.rb +0 -156
  104. data/test/test_nokogiri.rb +0 -138
  105. data/test/test_soap4r_sax.rb +0 -52
  106. data/test/test_xslt_transforms.rb +0 -314
  107. data/test/xml/node/test_save_options.rb +0 -28
  108. data/test/xml/node/test_subclass.rb +0 -44
  109. data/test/xml/sax/test_parser.rb +0 -402
  110. data/test/xml/sax/test_parser_context.rb +0 -115
  111. data/test/xml/sax/test_parser_text.rb +0 -202
  112. data/test/xml/sax/test_push_parser.rb +0 -265
  113. data/test/xml/test_attr.rb +0 -74
  114. data/test/xml/test_attribute_decl.rb +0 -86
  115. data/test/xml/test_builder.rb +0 -341
  116. data/test/xml/test_c14n.rb +0 -180
  117. data/test/xml/test_cdata.rb +0 -54
  118. data/test/xml/test_comment.rb +0 -40
  119. data/test/xml/test_document.rb +0 -982
  120. data/test/xml/test_document_encoding.rb +0 -31
  121. data/test/xml/test_document_fragment.rb +0 -298
  122. data/test/xml/test_dtd.rb +0 -187
  123. data/test/xml/test_dtd_encoding.rb +0 -31
  124. data/test/xml/test_element_content.rb +0 -56
  125. data/test/xml/test_element_decl.rb +0 -73
  126. data/test/xml/test_entity_decl.rb +0 -122
  127. data/test/xml/test_entity_reference.rb +0 -262
  128. data/test/xml/test_namespace.rb +0 -96
  129. data/test/xml/test_node.rb +0 -1325
  130. data/test/xml/test_node_attributes.rb +0 -115
  131. data/test/xml/test_node_encoding.rb +0 -75
  132. data/test/xml/test_node_inheritance.rb +0 -32
  133. data/test/xml/test_node_reparenting.rb +0 -592
  134. data/test/xml/test_node_set.rb +0 -809
  135. data/test/xml/test_parse_options.rb +0 -64
  136. data/test/xml/test_processing_instruction.rb +0 -30
  137. data/test/xml/test_reader.rb +0 -620
  138. data/test/xml/test_reader_encoding.rb +0 -134
  139. data/test/xml/test_relax_ng.rb +0 -60
  140. data/test/xml/test_schema.rb +0 -142
  141. data/test/xml/test_syntax_error.rb +0 -36
  142. data/test/xml/test_text.rb +0 -60
  143. data/test/xml/test_unparented_node.rb +0 -483
  144. data/test/xml/test_xinclude.rb +0 -83
  145. data/test/xml/test_xpath.rb +0 -470
  146. data/test/xslt/test_custom_functions.rb +0 -133
  147. data/test/xslt/test_exception_handling.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8a0b2422e8eb44142a8f8c1c0a0443b844db2a9d73c66bba59f239d800be9da
4
- data.tar.gz: eee2e520dd02954386e3b3c83b02ff9fcb12339edcfc9aaf124835badd9b3239
3
+ metadata.gz: a2a790da6f884cfbbebd155a97ab4c3be5fd8ec96a0819a44834996453f9f9b3
4
+ data.tar.gz: fc972743c712fde37bd6f10594ce6db727de0f78f809fa9bfb94db4e712d8492
5
5
  SHA512:
6
- metadata.gz: c967b49cdb174560fc8519d3e7e7252e4d3bd6e7fde2d13e3b052a9c050291e6ea375cb039fbb96ab9599516bf1dba33e3d606175c08a7db07e4c1abc1f16d4a
7
- data.tar.gz: ff74b9432fddaff768ba2bda7547461c86ec65133b9c1818a178b75d4db603d1a200204a95e16c5b7fc563f39d2210446ddcf9d18a8eeb4939d597b957074b26
6
+ metadata.gz: de24a0ae431a5f9f19a5f86307f0d5c4ec370849b90da70ff08f01cd017617426b94de3e477e6db0c86f14a78a2b9f70617dce1ffe6310d0942d7e665248594d
7
+ data.tar.gz: b6b0f502a24638a80f0b9002b9510457980a65f57d46fda704989912c78f40d375b250a6de4019a59f1b0aee81a18dbd57af7c8ba4f985f4a4c4c9aa2740abf0
data/README.md CHANGED
@@ -18,7 +18,6 @@ or CSS3 selectors.
18
18
 
19
19
  [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/ruby-2.4-system/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri?groups=master)
20
20
  [![Code Climate](https://codeclimate.com/github/sparklemotion/nokogiri.svg)](https://codeclimate.com/github/sparklemotion/nokogiri)
21
- [![Version Eye](https://www.versioneye.com/ruby/nokogiri/badge.png)](https://www.versioneye.com/ruby/nokogiri)
22
21
  [![Join the chat at https://gitter.im/sparklemotion/nokogiri](https://badges.gitter.im/sparklemotion/nokogiri.svg)](https://gitter.im/sparklemotion/nokogiri?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
23
22
 
24
23
 
@@ -400,9 +400,11 @@ if openbsd? && !using_system_libraries?
400
400
  ENV['CFLAGS'] = "#{ENV['CFLAGS']} -I /usr/local/include"
401
401
  end
402
402
 
403
- RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
403
+ if ENV['CC']
404
+ RbConfig::CONFIG['CC'] = RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC']
405
+ end
404
406
  # use same c compiler for libxml and libxslt
405
- ENV['CC'] = RbConfig::MAKEFILE_CONFIG['CC']
407
+ ENV['CC'] = RbConfig::CONFIG['CC']
406
408
 
407
409
  $LIBS << " #{ENV["LIBS"]}"
408
410
 
@@ -432,7 +434,7 @@ if RUBY_PLATFORM =~ /mingw/i
432
434
  $CPPFLAGS << ' "-Idummypath"'
433
435
  end
434
436
 
435
- if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
437
+ if RbConfig::CONFIG['CC'] =~ /gcc/
436
438
  $CFLAGS << " -O3" unless $CFLAGS[/-O\d/]
437
439
  $CFLAGS << " -Wall -Wcast-qual -Wwrite-strings -Wmissing-noreturn -Winline"
438
440
  end
@@ -460,7 +462,7 @@ else
460
462
  # The gem version constraint in the Rakefile is not respected at install time.
461
463
  # Keep this version in sync with the one in the Rakefile !
462
464
  require 'rubygems'
463
- gem 'mini_portile2', '~> 2.3.0'
465
+ gem 'mini_portile2', '~> 2.4.0'
464
466
  require 'mini_portile2'
465
467
  message "Using mini_portile version #{MiniPortile::VERSION}\n"
466
468
 
@@ -560,7 +562,8 @@ EOM
560
562
  *(libiconv_recipe ? "--with-iconv=#{libiconv_recipe.path}" : iconv_configure_flags),
561
563
  "--with-c14n",
562
564
  "--with-debug",
563
- "--with-threads"
565
+ "--with-threads",
566
+ *(darwin? ? ["RANLIB=/usr/bin/ranlib", "AR=/usr/bin/ar"] : "")
564
567
  ]
565
568
  end
566
569
 
@@ -573,7 +576,8 @@ EOM
573
576
  "--without-python",
574
577
  "--without-crypto",
575
578
  "--with-debug",
576
- "--with-libxml-prefix=#{sh_export_path(libxml2_recipe.path)}"
579
+ "--with-libxml-prefix=#{sh_export_path(libxml2_recipe.path)}",
580
+ *(darwin? ? ["RANLIB=/usr/bin/ranlib", "AR=/usr/bin/ar"] : "")
577
581
  ]
578
582
  end
579
583
 
@@ -4,37 +4,40 @@
4
4
  * call-seq:
5
5
  * value=(content)
6
6
  *
7
- * Set the value for this Attr to +content+
7
+ * Set the value for this Attr to +content+. Use `nil` to remove the value
8
+ * (e.g., a HTML boolean attribute).
8
9
  */
9
10
  static VALUE set_value(VALUE self, VALUE content)
10
11
  {
11
12
  xmlAttrPtr attr;
12
- Data_Get_Struct(self, xmlAttr, attr);
13
+ xmlChar *value;
14
+ xmlNode *cur;
13
15
 
14
- if (attr->children) { xmlFreeNodeList(attr->children); }
16
+ Data_Get_Struct(self, xmlAttr, attr);
15
17
 
18
+ if (attr->children) {
19
+ xmlFreeNodeList(attr->children);
20
+ }
16
21
  attr->children = attr->last = NULL;
17
22
 
18
- if (content) {
19
- xmlChar *buffer;
20
- xmlNode *tmp;
21
-
22
- /* Encode our content */
23
- buffer = xmlEncodeEntitiesReentrant(attr->doc, (unsigned char *)StringValueCStr(content));
23
+ if (content == Qnil) {
24
+ return content;
25
+ }
24
26
 
25
- attr->children = xmlStringGetNodeList(attr->doc, buffer);
26
- attr->last = NULL;
27
- tmp = attr->children;
27
+ value = xmlEncodeEntitiesReentrant(attr->doc, (unsigned char *)StringValueCStr(content));
28
+ if (xmlStrlen(value) == 0) {
29
+ attr->children = xmlNewDocText(attr->doc, value);
30
+ } else {
31
+ attr->children = xmlStringGetNodeList(attr->doc, value);
32
+ }
33
+ xmlFree(value);
28
34
 
29
- /* Loop through the children */
30
- for(tmp = attr->children; tmp; tmp = tmp->next) {
31
- tmp->parent = (xmlNode *)attr;
32
- tmp->doc = attr->doc;
33
- if (tmp->next == NULL) { attr->last = tmp; }
35
+ for (cur = attr->children; cur; cur = cur->next) {
36
+ cur->parent = (xmlNode *)attr;
37
+ cur->doc = attr->doc;
38
+ if (cur->next == NULL) {
39
+ attr->last = cur;
34
40
  }
35
-
36
- /* Free up memory */
37
- xmlFree(buffer);
38
41
  }
39
42
 
40
43
  return content;
@@ -74,7 +77,9 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
74
77
  rb_node = Nokogiri_wrap_xml_node(klass, (xmlNodePtr)node);
75
78
  rb_obj_call_init(rb_node, argc, argv);
76
79
 
77
- if (rb_block_given_p()) { rb_yield(rb_node); }
80
+ if (rb_block_given_p()) {
81
+ rb_yield(rb_node);
82
+ }
78
83
 
79
84
  return rb_node;
80
85
  }
@@ -7,7 +7,10 @@ static int dealloc_node_i(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc)
7
7
  xmlFreePropList((xmlAttrPtr)node);
8
8
  break;
9
9
  case XML_NAMESPACE_DECL:
10
- xmlFree(node);
10
+ xmlFreeNs((xmlNsPtr)node);
11
+ break;
12
+ case XML_DTD_NODE:
13
+ xmlFreeDtd((xmlDtdPtr)node);
11
14
  break;
12
15
  default:
13
16
  if(node->parent == NULL) {
@@ -63,7 +63,7 @@ static int part_of_an_xpath_node_set_eh(xmlNsPtr node)
63
63
 
64
64
  VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node)
65
65
  {
66
- VALUE ns, document, node_cache;
66
+ VALUE ns = 0, document, node_cache;
67
67
 
68
68
  assert(doc->type == XML_DOCUMENT_NODE || doc->type == XML_HTML_DOCUMENT_NODE);
69
69
 
@@ -71,8 +71,6 @@ VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node)
71
71
 
72
72
  if (doc->type == XML_DOCUMENT_FRAG_NODE) doc = doc->doc;
73
73
 
74
- ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, 0, node);
75
-
76
74
  if (DOC_RUBY_OBJECT_TEST(doc)) {
77
75
  document = DOC_RUBY_OBJECT(doc);
78
76
 
@@ -91,6 +89,8 @@ VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node)
91
89
  }
92
90
 
93
91
  rb_iv_set(ns, "@document", document);
92
+ } else {
93
+ ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, 0, node);
94
94
  }
95
95
 
96
96
  node->_private = (void *)ns;
@@ -7,8 +7,7 @@ void init_xml_namespace();
7
7
 
8
8
  extern VALUE cNokogiriXmlNamespace ;
9
9
 
10
- VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node) ;
11
- VALUE Nokogiri_wrap_xml_namespace2(VALUE document, xmlNsPtr node) ;
10
+ VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node);
12
11
 
13
12
  #define NOKOGIRI_NAMESPACE_EH(node) ((node)->type == XML_NAMESPACE_DECL)
14
13
 
@@ -31,13 +31,13 @@ typedef xmlNodePtr (*pivot_reparentee_func)(xmlNodePtr, xmlNodePtr);
31
31
  static void relink_namespace(xmlNodePtr reparented)
32
32
  {
33
33
  xmlNodePtr child;
34
- xmlNsPtr ns;
35
34
 
36
35
  if (reparented->type != XML_ATTRIBUTE_NODE &&
37
36
  reparented->type != XML_ELEMENT_NODE) { return; }
38
37
 
39
38
  if (reparented->ns == NULL || reparented->ns->prefix == NULL) {
40
- xmlChar *name = 0, *prefix = 0;
39
+ xmlNsPtr ns = NULL;
40
+ xmlChar *name = NULL, *prefix = NULL;
41
41
 
42
42
  name = xmlSplitQName2(reparented->name, &prefix);
43
43
 
@@ -99,6 +99,25 @@ static void relink_namespace(xmlNodePtr reparented)
99
99
  }
100
100
  }
101
101
 
102
+ /*
103
+ * Search our parents for an existing definition of current namespace,
104
+ * because the definition it's pointing to may have just been removed nsDef.
105
+ *
106
+ * And although that would technically probably be OK, I'd feel better if we
107
+ * referred to a namespace that's still present in a node's nsDef somewhere
108
+ * in the doc.
109
+ */
110
+ if (reparented->ns) {
111
+ xmlNsPtr ns = xmlSearchNs(reparented->doc, reparented, reparented->ns->prefix);
112
+ if (ns
113
+ && ns != reparented->ns
114
+ && xmlStrEqual(ns->prefix, reparented->ns->prefix)
115
+ && xmlStrEqual(ns->href, reparented->ns->href)
116
+ ) {
117
+ xmlSetNs(reparented, ns);
118
+ }
119
+ }
120
+
102
121
  /* Only walk all children if there actually is a namespace we need to */
103
122
  /* reparent. */
104
123
  if (NULL == reparented->ns) { return; }
@@ -282,7 +301,11 @@ ok:
282
301
  }
283
302
 
284
303
  if (original_ns_prefix_is_default && reparentee->ns != NULL && reparentee->ns->prefix != NULL) {
285
- /* issue #391, where new node's prefix may become the string "default" */
304
+ /*
305
+ * issue #391, where new node's prefix may become the string "default"
306
+ * see libxml2 tree.c xmlNewReconciliedNs which implements this behavior.
307
+ */
308
+ xmlFree(reparentee->ns->prefix);
286
309
  reparentee->ns->prefix = NULL;
287
310
  }
288
311
  }
@@ -509,22 +532,39 @@ static VALUE internal_subset(VALUE self)
509
532
  /*
510
533
  * call-seq:
511
534
  * dup
535
+ * dup(depth)
536
+ * dup(depth, new_parent_doc)
512
537
  *
513
- * Copy this node. An optional depth may be passed in, but it defaults
514
- * to a deep copy. 0 is a shallow copy, 1 is a deep copy.
538
+ * Copy this node.
539
+ * An optional depth may be passed in. 0 is a shallow copy, 1 (the default) is a deep copy.
540
+ * An optional new_parent_doc may also be passed in, which will be the new
541
+ * node's parent document. Defaults to the current node's document.
542
+ * current document.
515
543
  */
516
544
  static VALUE duplicate_node(int argc, VALUE *argv, VALUE self)
517
545
  {
518
- VALUE level;
546
+ VALUE r_level, r_new_parent_doc;
547
+ int level;
548
+ int n_args;
549
+ xmlDocPtr new_parent_doc;
519
550
  xmlNodePtr node, dup;
520
551
 
521
- if(rb_scan_args(argc, argv, "01", &level) == 0) {
522
- level = INT2NUM((long)1);
552
+ Data_Get_Struct(self, xmlNode, node);
553
+
554
+ n_args = rb_scan_args(argc, argv, "02", &r_level, &r_new_parent_doc);
555
+
556
+ if (n_args < 1) {
557
+ r_level = INT2NUM((long)1);
523
558
  }
559
+ level = (int)NUM2INT(r_level);
524
560
 
525
- Data_Get_Struct(self, xmlNode, node);
561
+ if (n_args < 2) {
562
+ new_parent_doc = node->doc;
563
+ } else {
564
+ Data_Get_Struct(r_new_parent_doc, xmlDoc, new_parent_doc);
565
+ }
526
566
 
527
- dup = xmlDocCopyNode(node, node->doc, (int)NUM2INT(level));
567
+ dup = xmlDocCopyNode(node, new_parent_doc, level);
528
568
  if(dup == NULL) { return Qnil; }
529
569
 
530
570
  nokogiri_root_node(dup);
@@ -1308,11 +1348,11 @@ static VALUE line(VALUE self)
1308
1348
  */
1309
1349
  static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1310
1350
  {
1311
- xmlNodePtr node, namespacee;
1351
+ xmlNodePtr node, namespace;
1312
1352
  xmlNsPtr ns;
1313
1353
 
1314
1354
  Data_Get_Struct(self, xmlNode, node);
1315
- namespacee = node ;
1355
+ namespace = node ;
1316
1356
 
1317
1357
  ns = xmlSearchNs(
1318
1358
  node->doc,
@@ -1322,10 +1362,10 @@ static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1322
1362
 
1323
1363
  if(!ns) {
1324
1364
  if (node->type != XML_ELEMENT_NODE) {
1325
- namespacee = node->parent;
1365
+ namespace = node->parent;
1326
1366
  }
1327
1367
  ns = xmlNewNs(
1328
- namespacee,
1368
+ namespace,
1329
1369
  (const xmlChar *)StringValueCStr(href),
1330
1370
  (const xmlChar *)(NIL_P(prefix) ? NULL : StringValueCStr(prefix))
1331
1371
  );
@@ -1333,7 +1373,7 @@ static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1333
1373
 
1334
1374
  if (!ns) { return Qnil ; }
1335
1375
 
1336
- if(NIL_P(prefix) || node != namespacee) { xmlSetNs(node, ns); }
1376
+ if(NIL_P(prefix) || node != namespace) { xmlSetNs(node, ns); }
1337
1377
 
1338
1378
  return Nokogiri_wrap_xml_namespace(node->doc, ns);
1339
1379
  }
@@ -31,64 +31,64 @@ end
31
31
 
32
32
  racc_action_table = [
33
33
  24, 93, 56, 57, 33, 55, 94, 23, 24, 22,
34
- 12, 93, 33, 27, 89, 52, 92, 22, -23, 25,
35
- 109, 98, 23, 33, 26, 18, 20, 25, 27, -23,
34
+ 12, 93, 33, 27, 35, 52, 44, 22, -23, 25,
35
+ 45, 98, 23, 33, 26, 18, 20, 25, 27, -23,
36
36
  23, 24, 26, 18, 20, 33, 27, 11, 39, 24,
37
- 22, 23, 95, 33, 18, 91, 90, 27, 22, 12,
38
- 25, 90, 96, 23, 33, 26, 18, 20, 25, 27,
39
- -23, 23, 24, 26, 18, 20, 33, 27, 74, 39,
40
- 99, 22, 23, 45, 24, 18, 33, 103, 27, 56,
41
- 87, 25, 60, 46, 23, 49, 26, 18, 20, 104,
42
- 27, 39, 24, 51, 23, 93, 44, 18, 26, 33,
43
- 27, 66, 106, 56, 58, 110, 60, 33, 85, 33,
44
- 86, 51, 56, 87, 39, 60, 26, 23, 88, 33,
45
- 18, 20, 39, 27, 39, 23, 35, 23, 18, 33,
46
- 18, 27, nil, 27, 39, nil, 33, 23, nil, nil,
47
- 18, 22, nil, 27, 39, 101, 100, 23, 102, nil,
48
- 18, 39, nil, 27, 23, 82, 83, 18, 20, nil,
49
- 27, nil, nil, nil, 82, 83, 78, 79, 80, nil,
50
- 81, nil, nil, nil, 77, 78, 79, 80, nil, 81,
51
- 4, 5, 43, 77, 4, 5, 10, nil, 56, 87,
52
- 6, 60, 8, 7, 6, nil, 8, 7, 4, 5,
53
- 10, 56, 87, nil, 60, nil, nil, nil, 6, nil,
54
- 8, 7 ]
37
+ 22, 23, 74, 33, 18, 91, 90, 27, 22, 12,
38
+ 25, 24, -23, 23, 85, 26, 18, 20, 25, 27,
39
+ 66, 23, 24, 26, 18, 20, 33, 27, 86, 88,
40
+ 51, 22, 89, 92, 24, 26, 56, 87, 95, 60,
41
+ 90, 25, 96, 46, 23, 49, 26, 18, 20, 99,
42
+ 27, 33, 33, 51, 103, 104, 56, 58, 26, 60,
43
+ 93, 106, 33, 33, 33, 109, 39, 39, 110, 23,
44
+ 23, nil, 18, 18, 20, 27, 27, 39, 39, 39,
45
+ 23, 23, 23, 18, 18, 18, 27, 27, 27, 33,
46
+ 33, 101, 100, nil, 102, 22, 56, 87, nil, 60,
47
+ 33, nil, nil, nil, 39, 39, nil, 23, 23, nil,
48
+ 18, 18, 20, 27, 27, 39, 82, 83, 23, 56,
49
+ 87, 18, 60, nil, 27, 82, 83, 78, 79, 80,
50
+ nil, 81, nil, nil, nil, 77, 78, 79, 80, nil,
51
+ 81, 4, 5, 10, 77, 4, 5, 43, nil, 56,
52
+ 87, 6, 60, 8, 7, 6, nil, 8, 7, 4,
53
+ 5, 10, nil, nil, nil, nil, nil, nil, nil, 6,
54
+ nil, 8, 7 ]
55
55
 
56
56
  racc_action_check = [
57
- 3, 58, 24, 24, 3, 24, 57, 15, 42, 3,
58
- 64, 57, 42, 15, 54, 24, 56, 42, 58, 3,
59
- 94, 64, 3, 31, 3, 3, 3, 42, 3, 22,
60
- 42, 9, 42, 42, 42, 9, 42, 1, 31, 43,
61
- 9, 31, 59, 43, 31, 55, 55, 31, 43, 1,
62
- 9, 60, 61, 9, 30, 9, 9, 9, 43, 9,
63
- 46, 43, 12, 43, 43, 43, 12, 43, 45, 30,
64
- 75, 12, 30, 21, 23, 30, 29, 84, 30, 93,
65
- 93, 12, 93, 23, 12, 23, 12, 12, 12, 86,
66
- 12, 29, 27, 23, 29, 87, 18, 29, 23, 25,
67
- 29, 27, 91, 25, 25, 106, 25, 28, 49, 62,
68
- 50, 27, 51, 51, 25, 51, 27, 25, 53, 14,
69
- 25, 25, 28, 25, 62, 28, 11, 62, 28, 32,
70
- 62, 28, nil, 62, 14, nil, 39, 14, nil, nil,
71
- 14, 39, nil, 14, 32, 76, 76, 32, 76, nil,
72
- 32, 39, nil, 32, 39, 47, 47, 39, 39, nil,
73
- 39, nil, nil, nil, 48, 48, 47, 47, 47, nil,
74
- 47, nil, nil, nil, 47, 48, 48, 48, nil, 48,
75
- 17, 17, 17, 48, 0, 0, 0, nil, 90, 90,
76
- 17, 90, 17, 17, 0, nil, 0, 0, 26, 26,
77
- 26, 92, 92, nil, 92, nil, nil, nil, 26, nil,
78
- 26, 26 ]
57
+ 3, 58, 24, 24, 3, 24, 57, 15, 9, 3,
58
+ 64, 57, 9, 15, 11, 24, 18, 9, 58, 3,
59
+ 21, 64, 3, 14, 3, 3, 3, 9, 3, 22,
60
+ 9, 12, 9, 9, 9, 12, 9, 1, 14, 42,
61
+ 12, 14, 45, 42, 14, 55, 55, 14, 42, 1,
62
+ 12, 27, 46, 12, 49, 12, 12, 12, 42, 12,
63
+ 27, 42, 43, 42, 42, 42, 43, 42, 50, 53,
64
+ 27, 43, 54, 56, 23, 27, 51, 51, 59, 51,
65
+ 60, 43, 61, 23, 43, 23, 43, 43, 43, 75,
66
+ 43, 28, 25, 23, 84, 86, 25, 25, 23, 25,
67
+ 87, 91, 29, 30, 31, 94, 28, 25, 106, 28,
68
+ 25, nil, 28, 25, 25, 28, 25, 29, 30, 31,
69
+ 29, 30, 31, 29, 30, 31, 29, 30, 31, 32,
70
+ 39, 76, 76, nil, 76, 39, 90, 90, nil, 90,
71
+ 62, nil, nil, nil, 32, 39, nil, 32, 39, nil,
72
+ 32, 39, 39, 32, 39, 62, 47, 47, 62, 92,
73
+ 92, 62, 92, nil, 62, 48, 48, 47, 47, 47,
74
+ nil, 47, nil, nil, nil, 47, 48, 48, 48, nil,
75
+ 48, 0, 0, 0, 48, 17, 17, 17, nil, 93,
76
+ 93, 0, 93, 0, 0, 17, nil, 17, 17, 26,
77
+ 26, 26, nil, nil, nil, nil, nil, nil, nil, 26,
78
+ nil, 26, 26 ]
79
79
 
80
80
  racc_action_pointer = [
81
- 177, 37, nil, -2, nil, nil, nil, nil, nil, 29,
82
- nil, 126, 60, nil, 113, -17, nil, 173, 85, nil,
83
- nil, 44, 0, 72, -8, 93, 191, 90, 101, 70,
84
- 48, 17, 123, nil, nil, nil, nil, nil, nil, 130,
85
- nil, nil, 6, 37, nil, 57, 31, 152, 161, 83,
86
- 81, 102, nil, 95, -9, 34, 4, -1, -11, 19,
87
- 39, 29, 103, nil, -2, nil, nil, nil, nil, nil,
88
- nil, nil, nil, nil, nil, 45, 135, nil, nil, nil,
89
- nil, nil, nil, nil, 52, nil, 78, 83, nil, nil,
90
- 178, 95, 191, 69, 7, nil, nil, nil, nil, nil,
91
- nil, nil, nil, nil, nil, nil, 92, nil, nil, nil,
81
+ 174, 37, nil, -2, nil, nil, nil, nil, nil, 6,
82
+ nil, 14, 29, nil, 17, -17, nil, 178, 5, nil,
83
+ nil, -9, 0, 72, -8, 86, 192, 49, 85, 96,
84
+ 97, 98, 123, nil, nil, nil, nil, nil, nil, 124,
85
+ nil, nil, 37, 60, nil, 31, 23, 153, 162, 29,
86
+ 39, 66, nil, 46, 49, 34, 61, -1, -11, 55,
87
+ 68, 59, 134, nil, -2, nil, nil, nil, nil, nil,
88
+ nil, nil, nil, nil, nil, 64, 121, nil, nil, nil,
89
+ nil, nil, nil, nil, 69, nil, 84, 88, nil, nil,
90
+ 126, 94, 149, 179, 92, nil, nil, nil, nil, nil,
91
+ nil, nil, nil, nil, nil, nil, 95, nil, nil, nil,
92
92
  nil ]
93
93
 
94
94
  racc_action_default = [
@@ -106,26 +106,26 @@ racc_action_default = [
106
106
  -41 ]
107
107
 
108
108
  racc_goto_table = [
109
- 53, 38, 13, 1, 54, 48, 62, 42, 34, 65,
110
- 37, 36, 63, 75, 84, 67, 68, 69, 70, 71,
111
- 62, 40, 41, 50, 47, nil, 63, nil, nil, 64,
109
+ 53, 38, 13, 1, 42, 48, 62, 37, 34, 65,
110
+ 40, 36, 63, 75, 84, 67, 68, 69, 70, 71,
111
+ 62, 41, 50, 47, 54, nil, 63, nil, nil, 64,
112
112
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
113
113
  nil, 72, 73, nil, nil, nil, nil, nil, nil, 97,
114
114
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
115
115
  nil, nil, nil, nil, nil, nil, 105, nil, 107, 108 ]
116
116
 
117
117
  racc_goto_check = [
118
- 18, 12, 2, 1, 19, 9, 7, 5, 2, 9,
119
- 8, 2, 12, 17, 17, 12, 12, 12, 12, 12,
120
- 7, 10, 11, 15, 16, nil, 12, nil, nil, 1,
118
+ 18, 12, 2, 1, 5, 9, 7, 8, 2, 9,
119
+ 10, 2, 12, 17, 17, 12, 12, 12, 12, 12,
120
+ 7, 11, 15, 16, 19, nil, 12, nil, nil, 1,
121
121
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
122
122
  nil, 2, 2, nil, nil, nil, nil, nil, nil, 12,
123
123
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
124
124
  nil, nil, nil, nil, nil, nil, 18, nil, 18, 18 ]
125
125
 
126
126
  racc_goto_pointer = [
127
- nil, 3, -1, nil, nil, -10, nil, -19, -4, -18,
128
- 6, 7, -13, nil, nil, 0, 1, -34, -24, -20,
127
+ nil, 3, -1, nil, nil, -13, nil, -19, -7, -18,
128
+ -5, 6, -13, nil, nil, -1, 0, -34, -24, 0,
129
129
  nil, nil, nil, nil ]
130
130
 
131
131
  racc_goto_default = [
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.8.5'
3
+ VERSION = '1.9.1'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -25,6 +25,17 @@ module Nokogiri
25
25
  children.each { |child| child.parent = self }
26
26
  end
27
27
 
28
+ if Nokogiri.uses_libxml?
29
+ def dup
30
+ new_document = document.dup
31
+ new_fragment = self.class.new(new_document)
32
+ children.each do |child|
33
+ child.dup(1, new_document).parent = new_fragment
34
+ end
35
+ new_fragment
36
+ end
37
+ end
38
+
28
39
  ###
29
40
  # return the name for DocumentFragment
30
41
  def name
@@ -161,6 +161,18 @@ module Nokogiri
161
161
  end
162
162
  end
163
163
 
164
+
165
+ ###
166
+ # Add html around this node
167
+ #
168
+ # Returns self
169
+ def wrap(html)
170
+ new_parent = document.parse(html).first
171
+ add_next_sibling(new_parent)
172
+ new_parent.add_child(self)
173
+ self
174
+ end
175
+
164
176
  ###
165
177
  # Add +node_or_tags+ as a child of this Node.
166
178
  # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
@@ -203,6 +203,7 @@ module Nokogiri
203
203
  0.upto(length - 1) do |x|
204
204
  yield self[x]
205
205
  end
206
+ self
206
207
  end
207
208
 
208
209
  ###
@@ -230,14 +231,9 @@ module Nokogiri
230
231
  end
231
232
 
232
233
  ###
233
- # Wrap this NodeSet with +html+ or the results of the builder in +blk+
234
- def wrap(html, &blk)
235
- each do |j|
236
- new_parent = document.parse(html).first
237
- j.add_next_sibling(new_parent)
238
- new_parent.add_child(j)
239
- end
240
- self
234
+ # Wrap this NodeSet with +html+
235
+ def wrap html
236
+ map { |node| node.wrap html }
241
237
  end
242
238
 
243
239
  ###