Sha256: 46084b34a8fbd3c99eb58e4fa34d46491cd55e08157940b0ce8dbb6b06be6a54
Contents?: true
Size: 769 Bytes
Versions: 15
Compression:
Stored size: 769 Bytes
Contents
# backtick_javascript: true module Browser module Document extend DelegateNative extend EventTarget @native = `document` module_function # @return [Browser::Element] the head element of the current document def head @head ||= Element.new(`#@native.head`) end # @return [Browser::Element] the body element of the current document def body @body ||= Element.new(`#@native.body`) end # @return [Browser::Element?] the first element that matches the given CSS # selector or `nil` if no elements match def [] css native = `#@native.querySelector(css)` if `#{native} === null` nil else Element.new(native) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems