@@ -190,11 +190,6 @@ def remove
190
190
parent . remove_child ( self ) if parent
191
191
end
192
192
193
- # Remove all the children of the node.
194
- def clear
195
- children . remove
196
- end
197
-
198
193
# @!attribute content
199
194
# @return [String] the inner text content of the node
200
195
if Browser . supports? 'Element.textContent'
@@ -235,17 +230,19 @@ def cdata?
235
230
# @!attribute [r] child
236
231
# @return [Node?] the first child of the node
237
232
def child
238
- children . first
233
+ first_child
239
234
end
240
235
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` )
245
240
end
246
241
247
- def children = ( node )
248
- raise NotImplementedError
242
+ # @!attribute [r] last_child
243
+ # @return [Node?] the first child of the node
244
+ def last_child
245
+ DOM ( `#@native .lastChild` )
249
246
end
250
247
251
248
# Return true if the node is a comment.
@@ -271,20 +268,6 @@ def elem?
271
268
272
269
alias element? elem?
273
270
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
-
288
271
# Return true if the node is a document fragment.
289
272
def fragment?
290
273
node_type == DOCUMENT_FRAGMENT_NODE
@@ -303,12 +286,6 @@ def inner_html=(value)
303
286
alias inner_text content
304
287
alias inner_text = content =
305
288
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
-
312
289
# @!attribute name
313
290
# @return [String] the name of the node
314
291
def name
0 commit comments