Shaka Player Embedded
Public Member Functions | Static Public Member Functions | List of all members
shaka::js::dom::Document Class Reference

#include <document.h>

Inheritance diagram for shaka::js::dom::Document:
shaka::js::dom::ContainerNode shaka::js::dom::Node shaka::js::events::EventTarget shaka::BackingObject shaka::memory::Traceable

Public Member Functions

 Document ()
 
uint64_t created_at () const
 
std::string node_name () const override
 
optional< std::string > NodeValue () const override
 
optional< std::string > TextContent () const override
 
RefPtr< ElementDocumentElement () const
 
std::vector< RefPtr< Element > > GetElementsByTagName (const std::string &name) const override
 
RefPtr< ElementCreateElement (const std::string &name)
 
RefPtr< CommentCreateComment (const std::string &data)
 
RefPtr< TextCreateTextNode (const std::string &data)
 
ExceptionOr< RefPtr< Attr > > CreateAttribute (const std::string &name)
 
ExceptionOr< RefPtr< Attr > > CreateAttributeNS (const std::string &namespace_uri, const std::string &qualified_name)
 
- Public Member Functions inherited from shaka::js::dom::ContainerNode
 ContainerNode (NodeType type, RefPtr< Document > document)
 
ExceptionOr< RefPtr< Element > > QuerySelector (const std::string &query) const
 
- Public Member Functions inherited from shaka::js::dom::Node
 Node (NodeType type, RefPtr< Document > document)
 
void Trace (memory::HeapTracer *tracer) const override
 
bool IsShortLived () const override
 
RefPtr< Documentdocument () const
 
RefPtr< Nodeparent_node () const
 
std::vector< RefPtr< Node > > child_nodes () const
 
NodeType node_type () const
 
RefPtr< Nodefirst_child () const
 
RefPtr< Nodelast_child () const
 
RefPtr< NodeAppendChild (RefPtr< Node > new_child)
 
RefPtr< NodeRemoveChild (RefPtr< Node > to_remove)
 
bool is_document () const
 
bool is_element () const
 
bool is_char_data () const
 
- Public Member Functions inherited from shaka::js::events::EventTarget
 EventTarget ()
 
void Trace (memory::HeapTracer *tracer) const override
 
void AddEventListener (const std::string &type, Listener callback)
 
void SetCppEventListener (EventType type, std::function< void()> callback)
 
void RemoveEventListener (const std::string &type, Listener callback)
 
void UnsetCppEventListener (EventType type)
 
ExceptionOr< bool > DispatchEvent (RefPtr< Event > event)
 
ExceptionOr< bool > DispatchEventInternal (RefPtr< Event > event, bool *did_listeners_throw)
 
template<typename EventType , typename... Args>
std::shared_ptr< ThreadEvent< bool > > ScheduleEvent (Args &&... args)
 
template<typename EventType , typename... Args>
ExceptionOr< bool > RaiseEvent (Args... args)
 
- Public Member Functions inherited from shaka::BackingObject
 BackingObject ()
 
void Trace (memory::HeapTracer *tracer) const override
 
bool IsRootedAlive () const override
 
std::string name () const
 
virtual BackingObjectFactoryBasefactory () const =0
 
bool DerivedFrom (const std::string &base)
 
ReturnVal< JsValue > JsThis () const
 
void SetJsThis (Handle< JsObject > this_)
 
- Public Member Functions inherited from shaka::memory::Traceable
virtual ~Traceable ()
 

Static Public Member Functions

static DocumentCreate ()
 
static RefPtr< DocumentEnsureGlobalDocument ()
 
- Static Public Member Functions inherited from shaka::BackingObject
static void * operator new[] (size_t size)=delete
 
static void operator delete[] (void *)=delete
 

Additional Inherited Members

- Public Types inherited from shaka::js::dom::Node
enum  NodeType {
  ELEMENT_NODE = 1, ATTRIBUTE_NODE = 2, TEXT_NODE = 3, CDATA_SECTION_NODE = 4,
  ENTITY_REFERENCE_NODE = 5, ENTITY_NODE = 6, PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = 8,
  DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = 11, NOTATION_NODE = 12
}
 
enum  DocumentPosition {
  DOCUMENT_POSITION_DISCONNECTED = 0x01, DOCUMENT_POSITION_PRECEDING = 0x02, DOCUMENT_POSITION_FOLLOWING = 0x04, DOCUMENT_POSITION_CONTAINS = 0x08,
  DOCUMENT_POSITION_CONTAINED_BY = 0x10, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
}
 
- Public Types inherited from shaka::js::events::EventTarget
using Listener = optional< Callback >
 
- Static Public Attributes inherited from shaka::BackingObject
static constexpr const size_t kInternalFieldCount = 2
 
- Static Public Attributes inherited from shaka::memory::Traceable
static constexpr const uint64_t kShortLiveDurationMs = 5000
 
- Protected Member Functions inherited from shaka::js::events::EventTarget
void AddListenerField (EventType type, Listener *on_field)
 
- Protected Member Functions inherited from shaka::BackingObject
 ~BackingObject () override
 

Detailed Description

Implements the Document interface for DOM. https://dom.spec.whatwg.org/#document

Definition at line 38 of file document.h.

Constructor & Destructor Documentation

§ Document()

shaka::js::dom::Document::Document ( )

Definition at line 38 of file document.cc.

Member Function Documentation

§ Create()

static Document* shaka::js::dom::Document::Create ( )
inlinestatic

Definition at line 44 of file document.h.

§ CreateAttribute()

ExceptionOr< RefPtr< Attr > > shaka::js::dom::Document::CreateAttribute ( const std::string &  name)

Definition at line 111 of file document.cc.

§ CreateAttributeNS()

ExceptionOr< RefPtr< Attr > > shaka::js::dom::Document::CreateAttributeNS ( const std::string &  namespace_uri,
const std::string &  qualified_name 
)

Definition at line 120 of file document.cc.

§ CreateComment()

RefPtr< Comment > shaka::js::dom::Document::CreateComment ( const std::string &  data)

Definition at line 103 of file document.cc.

§ created_at()

uint64_t shaka::js::dom::Document::created_at ( ) const
inline
Returns
The time, in milliseconds, the document was created, according to Clock's getMonotonicTime.

Definition at line 53 of file document.h.

§ CreateElement()

RefPtr< Element > shaka::js::dom::Document::CreateElement ( const std::string &  name)

Definition at line 95 of file document.cc.

§ CreateTextNode()

RefPtr< Text > shaka::js::dom::Document::CreateTextNode ( const std::string &  data)

Definition at line 107 of file document.cc.

§ DocumentElement()

RefPtr< Element > shaka::js::dom::Document::DocumentElement ( ) const

Definition at line 77 of file document.cc.

§ EnsureGlobalDocument()

Doxygen_Skip RefPtr< Document > shaka::js::dom::Document::EnsureGlobalDocument ( )
static

Definition at line 51 of file document.cc.

§ GetElementsByTagName()

std::vector< RefPtr< Element > > shaka::js::dom::Document::GetElementsByTagName ( const std::string &  name) const
overridevirtual

Reimplemented from shaka::js::dom::ContainerNode.

Definition at line 85 of file document.cc.

§ node_name()

std::string shaka::js::dom::Document::node_name ( ) const
overridevirtual

Implements shaka::js::dom::Node.

Definition at line 65 of file document.cc.

§ NodeValue()

optional< std::string > shaka::js::dom::Document::NodeValue ( ) const
overridevirtual

Implements shaka::js::dom::Node.

Definition at line 69 of file document.cc.

§ TextContent()

optional< std::string > shaka::js::dom::Document::TextContent ( ) const
overridevirtual

Implements shaka::js::dom::Node.

Definition at line 73 of file document.cc.


The documentation for this class was generated from the following files: