Changeset 160
- Timestamp:
- 02/21/2008 13:36:48 (5 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
lib/hpricot/builder.rb (modified) (1 diff)
-
lib/hpricot/elements.rb (modified) (1 diff)
-
test/test_paths.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/hpricot/builder.rb
r156 r160 91 91 childs = [] 92 92 attrs = args.grep(Hash) 93 childs.concat((args - attrs). map do |x|93 childs.concat((args - attrs).flatten.map do |x| 94 94 if x.respond_to? :to_html 95 95 Hpricot.make(x.to_html) -
trunk/lib/hpricot/elements.rb
r155 r160 262 262 end 263 263 264 ATTR_RE = %r!\[ *(?:(@)([\w\(\)-]+)|([\w\(\)-]+\(\))) *([~\!\|\*$\^=]*) *'?"?([^ \]'"]*)'?"? *\]!i264 ATTR_RE = %r!\[ *(?:(@)([\w\(\)-]+)|([\w\(\)-]+\(\))) *([~\!\|\*$\^=]*) *'?"?([^'"]*)'?"? *\]!i 265 265 BRACK_RE = %r!(\[) *([^\]]*) *\]+!i 266 266 FUNC_RE = %r!(:)?([a-zA-Z0-9\*_-]*)\( *[\"']?([^ \)]*?)['\"]? *\)! -
trunk/test/test_paths.rb
r83 r160 14 14 end 15 15 end 16 def test_attr_brackets 17 doc = Hpricot('<input name="vendor[porkpies]"/>') 18 assert_equal 1, (doc/'input[@name^="vendor[porkpies]"]').length 19 assert_equal 1, (doc/'input[@name="vendor[porkpies]"]').length 20 assert_equal 0, (doc/'input[@name$="]]]]]"]').length 21 22 doc = Hpricot('<input name="vendor[porkpies][meaty]"/>') 23 assert_equal 1, (doc/'input[@name^="vendor[porkpies][meaty]"]').length 24 end 16 25 end
