@@ -190,11 +190,6 @@ def remove
190190 parent . remove_child ( self ) if parent
191191 end
192192
193- # Remove all the children of the node.
194- def clear
195- children . remove
196- end
197-
198193 # @!attribute content
199194 # @return [String] the inner text content of the node
200195 if Browser . supports? 'Element.textContent'
@@ -235,17 +230,19 @@ def cdata?
235230 # @!attribute [r] child
236231 # @return [Node?] the first child of the node
237232 def child
238- children . first
233+ first_child
239234 end
240235
241- # @!attribute children
242- # @return [NodeSet ] the children of the node
243- def children
244- NodeSet [ Native :: Array . new ( `#@native .childNodes` ) ]
236+ # @!attribute [r] first_child
237+ # @return [Node? ] the first child of the node
238+ def first_child
239+ DOM ( `#@native .firstChild` )
245240 end
246241
247- def children = ( node )
248- raise NotImplementedError
242+ # @!attribute [r] last_child
243+ # @return [Node?] the last child of the node
244+ def last_child
245+ DOM ( `#@native .lastChild` )
249246 end
250247
251248 # Return true if the node is a comment.
@@ -271,20 +268,6 @@ def elem?
271268
272269 alias element? elem?
273270
274- # @!attribute [r] element_children
275- # @return [NodeSet] all the children which are elements
276- def element_children
277- children . select ( &:element? )
278- end
279-
280- alias elements element_children
281-
282- # @!attribute [r] first_element_child
283- # @return [Element?] the first element child
284- def first_element_child
285- element_children . first
286- end
287-
288271 # Return true if the node is a document fragment.
289272 def fragment?
290273 node_type == DOCUMENT_FRAGMENT_NODE
@@ -303,12 +286,6 @@ def inner_html=(value)
303286 alias inner_text content
304287 alias inner_text = content =
305288
306- # @!attribute [r] last_element_child
307- # @return [Element?] the last element child
308- def last_element_child
309- element_children . last
310- end
311-
312289 # @!attribute name
313290 # @return [String] the name of the node
314291 def name
0 commit comments