nokogiri 1.5.8-x86-mingw32 → 1.5.9-x86-mingw32

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.

@@ -1,4 +1,13 @@
1
1
 
2
+ === 1.5.9 / 2013年03月21日
3
+
4
+ * Bugfixes
5
+
6
+ * Ensure that prefixed attributes are properly namespaced when reparented. #869
7
+ * Fix for inconsistent namespaced attribute access for SVG nested in HTML. #861
8
+ * (MRI) Fixed a memory leak in fragment parsing if nodes are not all subsequently reparented. #856
9
+
10
+
2
11
  === 1.5.8 / 2013年03月19日
3
12
 
4
13
  * Bugfixes
@@ -1,4 +1,13 @@
1
1
 
2
+ === 1.5.9 / 2013-03-21
3
+
4
+ * Bugfixes
5
+
6
+ * Ensure that prefixed attributes are properly namespaced when reparented. #869
7
+ * Fix for inconsistent namespaced attribute access for SVG nested in HTML. #861
8
+ * (MRI) Fixed a memory leak in fragment parsing if nodes are not all subsequently reparented. #856
9
+
10
+
2
11
  === 1.5.8 / 2013-03-19
3
12
 
4
13
  * Bugfixes
@@ -753,6 +753,8 @@ static VALUE get(VALUE self, VALUE rattribute)
753
753
  ns = xmlSearchNs(node->doc, node, (const xmlChar *)(prefix));
754
754
  if (ns) {
755
755
  value = xmlGetNsProp(node, (xmlChar*)(attr_name), ns->href);
756
+ } else {
757
+ value = xmlGetProp(node, (xmlChar*)StringValuePtr(rattribute));
756
758
  }
757
759
  } else {
758
760
  value = xmlGetNoNsProp(node, (xmlChar*)attribute);
@@ -1268,7 +1270,7 @@ static VALUE process_xincludes(VALUE self, VALUE options)
1268
1270
  /* TODO: DOCUMENT ME */
1269
1271
  static VALUE in_context(VALUE self, VALUE _str, VALUE _options)
1270
1272
  {
1271
- xmlNodePtr node, list = 0, child_iter, node_children, doc_children;
1273
+ xmlNodePtr node, list = 0, tmp, child_iter, node_children, doc_children;
1272
1274
  xmlNodeSetPtr set;
1273
1275
  xmlParserErrors error;
1274
1276
  VALUE doc, err;
@@ -1355,8 +1357,11 @@ static VALUE in_context(VALUE self, VALUE _str, VALUE _options)
1355
1357
  set = xmlXPathNodeSetCreate(NULL);
1356
1358
 
1357
1359
  while (list) {
1360
+ tmp = list->next;
1361
+ list->next = NULL;
1358
1362
  xmlXPathNodeSetAddUnique(set, list);
1359
- list = list->next;
1363
+ nokogiri_root_node(list);
1364
+ list = tmp;
1360
1365
  }
1361
1366
 
1362
1367
  return Nokogiri_wrap_xml_node_set(set, doc);
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.5.8'
3
+ VERSION = '1.5.9'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -270,9 +270,9 @@ module Nokogiri
270
270
  def add_child node_or_tags
271
271
  node_or_tags = coerce(node_or_tags)
272
272
  if node_or_tags.is_a?(XML::NodeSet)
273
- node_or_tags.each { |n| add_child_node n }
273
+ node_or_tags.each { |n| add_child_node_and_reparent_attrs n }
274
274
  else
275
- add_child_node node_or_tags
275
+ add_child_node_and_reparent_attrs node_or_tags
276
276
  end
277
277
  node_or_tags
278
278
  end
@@ -361,9 +361,9 @@ module Nokogiri
361
361
  node_or_tags = coerce(node_or_tags)
362
362
  children.unlink
363
363
  if node_or_tags.is_a?(XML::NodeSet)
364
- node_or_tags.each { |n| add_child_node n }
364
+ node_or_tags.each { |n| add_child_node_and_reparent_attrs n }
365
365
  else
366
- add_child_node node_or_tags
366
+ add_child_node_and_reparent_attrs node_or_tags
367
367
  end
368
368
  node_or_tags
369
369
  end
@@ -938,6 +938,15 @@ Requires a Node, NodeSet or String argument, and cannot accept a #{data.class}.
938
938
  def inspect_attributes
939
939
  [:name, :namespace, :attribute_nodes, :children]
940
940
  end
941
+
942
+ def add_child_node_and_reparent_attrs node
943
+ add_child_node node
944
+ node.attribute_nodes.find_all { |a| a.name =~ /:/ }.each do |attr_node|
945
+ attr_node.remove
946
+ node[attr_node.name] = attr_node.value
947
+ end
948
+ end
949
+
941
950
  end
942
951
  end
943
952
  end
@@ -34,6 +34,14 @@ module Nokogiri
34
34
  assert_match(/%22AGGA-KA-BOO!%22/, element.to_html)
35
35
  end
36
36
 
37
+ # The HTML parser ignores namespaces, so even properly declared namespaces
38
+ # are treated as as undeclared and have to be accessed via prefix:tagname
39
+ def test_ns_attribute
40
+ html = '<i foo:bar="baz"></i>'
41
+ doc = Nokogiri::HTML(html)
42
+ assert_equal 'baz', (doc%'i')['foo:bar']
43
+ end
44
+
37
45
  def test_css_path_round_trip
38
46
  doc = Nokogiri::HTML(File.read(HTML_FILE))
39
47
  %w{ #header small div[2] div.post body }.each do |css_sel|
@@ -61,6 +61,15 @@ module Nokogiri
61
61
  ns_attrs = n.to_xml.scan(/\bxmlns(?::.+?)?=/)
62
62
  assert_equal 3, ns_attrs.length
63
63
  end
64
+
65
+ def test_builder_namespaced_attribute_on_unparented_node
66
+ doc = Nokogiri::XML::Builder.new do |x|
67
+ x.root('xmlns:foo' => 'http://foo.io') {
68
+ x.obj('foo:attr' => 'baz')
69
+ }
70
+ end.doc
71
+ assert_equal 'http://foo.io', doc.root.children.first.attribute_nodes.first.namespace.href
72
+ end
64
73
  end
65
74
  end
66
75
  end
@@ -63,6 +63,13 @@ module Nokogiri
63
63
  ns_attrs = n.to_xml.scan(/\bxmlns(?::.+?)?=/)
64
64
  assert_equal 3, ns_attrs.length
65
65
  end
66
+
67
+ def test_created_namespaced_attribute_on_unparented_node
68
+ doc = Nokogiri::XML('<root xmlns:foo="http://foo.io"/>')
69
+ node = @doc.create_element('obj', 'foo:attr' => 'baz')
70
+ doc.root.add_child(node)
71
+ assert_equal 'http://foo.io', doc.root.children.first.attribute_nodes.first.namespace.href
72
+ end
66
73
  end
67
74
  end
68
75
  end
@@ -134,6 +134,10 @@ EOF
134
134
  end
135
135
  end
136
136
 
137
+ def test_in_context_parser_leak_ii
138
+ loop { Nokogiri::XML('<a/>').root.parse('<b/>') }
139
+ end
140
+
137
141
  def test_leak_on_xpath_string_function
138
142
  doc = Nokogiri::XML(@str)
139
143
  loop do
@@ -45,6 +45,20 @@ module Nokogiri
45
45
  assert_equal 'x', node.attributes['bar'].namespace.href
46
46
  end
47
47
 
48
+ def test_append_child_namespace_definitions_prefixed_attributes
49
+ doc = Nokogiri::XML "<root/>"
50
+ node = doc.root
51
+
52
+ node['xml:lang'] = 'en-GB'
53
+
54
+ assert_equal [], node.namespace_definitions.map(&:prefix)
55
+
56
+ child_node = Nokogiri::XML::Node.new 'foo', doc
57
+ node << child_node
58
+
59
+ assert_equal [], node.namespace_definitions.map(&:prefix)
60
+ end
61
+
48
62
  def test_namespace_key?
49
63
  doc = Nokogiri::XML <<-eoxml
50
64
  <root xmlns:tlm='http://tenderlovemaking.com/'>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 8
10
- version: 1.5.8
9
+ - 9
10
+ version: 1.5.9
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Aaron Patterson
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2013-03-19 00:00:00 Z
21
+ date: 2013-03-21 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  prerelease: false