Changeset 155 for trunk/lib/hpricot/traverse.rb
- Timestamp:
- 08/31/2007 17:30:41 (15 months ago)
- Files:
-
- 1 modified
-
trunk/lib/hpricot/traverse.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/hpricot/traverse.rb
r149 r155 21 21 def bogusetag?() BogusETag::Trav === self end 22 22 23 # Parses an HTML string, making an HTML fragment based on 24 # the options used to create the container document. 25 def make(input = nil, &blk) 26 if parent and parent.respond_to? :make 27 parent.make(input, &blk) 28 else 29 Hpricot.make(input, &blk) 30 end 31 end 32 23 33 # Builds an HTML string from this node and its contents. 24 34 # If you need to write to a stream, try calling <tt>output(io)</tt> … … 110 120 # Adds elements immediately after this element, contained in the +html+ string. 111 121 def after(html = nil, &blk) 112 parent.insert_after( Hpricot.make(html, &blk), self)122 parent.insert_after(make(html, &blk), self) 113 123 end 114 124 115 125 # Adds elements immediately before this element, contained in the +html+ string. 116 126 def before(html = nil, &blk) 117 parent.insert_before( Hpricot.make(html, &blk), self)127 parent.insert_before(make(html, &blk), self) 118 128 end 119 129 … … 123 133 def swap(html = nil, &blk) 124 134 parent.altered! 125 parent.replace_child(self, Hpricot.make(html, &blk))135 parent.replace_child(self, make(html, &blk)) 126 136 end 127 137 … … 159 169 self.children = inner 160 170 else 161 self.children = Hpricot.make(inner, &blk)171 self.children = make(inner, &blk) 162 172 end 163 173 reparent self.children
