Sha256: b6e00fa50ffd72bc3b399eb4cc27a85f91b43ff28eee731128d5cbe0c9c71ae2
Contents?: true
Size: 738 Bytes
Versions: 21
Compression:
Stored size: 738 Bytes
Contents
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
21 entries across 21 versions & 1 rubygems