Changeset 112

Show
Ignore:
Timestamp:
02/18/2007 02:23:49 (22 months ago)
Author:
lwu
Message:

Fix Traverse.before(html) -- ticket #61

Location:
trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/CHANGELOG

    r107 r112  
    11= 0.5 
    2 === 31rd January, 2006 
     2=== 31rd January, 2007 
    33 
    44* support for a[text()="Click Me!"] and h3[text()*="space"] and the like. 
  • trunk/lib/hpricot/elements.rb

    r106 r112  
    119119    # 
    120120    #   doc = Hpricot("<p> We have <i>so much</i> to say.</p>") 
    121     #   doc.search("i").empty 
     121    #   doc.search("i").empty! 
    122122    #   doc.to_html 
    123123    #     => "<p> We have <i></i> to say.</p>" 
    124124    # 
    125     def empty 
     125    def empty! 
    126126      each { |x| x.inner_html = nil } 
    127127    end 
  • trunk/lib/hpricot/traverse.rb

    r99 r112  
    8080    # Adds elements immediately before this element, contained in the +html+ string. 
    8181    def before(html) 
    82       parent.insert_after(Hpricot.make(html), self) 
     82      parent.insert_before(Hpricot.make(html), self) 
    8383    end 
    8484