Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/go-shiori/dom
/ functions
Functions
70 in github.com/go-shiori/dom
⨍
Functions
70
◇
Types & classes
0
↓ 31 callers
Function
parseHTMLSource
(htmlSource string)
dom_test.go:1308
↓ 24 callers
Function
GetElementsByTagName
GetElementsByTagName returns a collection of all elements in the document with the specified tag name, as an array of Node object. The special tag "*"
dom.go:125
↓ 22 callers
Function
OuterHTML
OuterHTML returns an HTML serialization of the element and its descendants. The returned HTML value is escaped.
dom.go:305
↓ 10 callers
Function
CreateElement
CreateElement creates a new ElementNode with specified tag.
dom.go:147
↓ 6 callers
Function
GetAttribute
GetAttribute returns the value of a specified attribute on the element. If the given attribute does not exist, the value returned will be an empty str
dom.go:179
↓ 4 callers
Function
AppendChild
AppendChild adds a node to the end of the list of children of a specified parent node. If the given child is a reference to an existing node in the do
dom.go:429
↓ 4 callers
Function
IsVoidElement
IsVoidElement check whether a node can have any contents or not. Return true if element is void (can't have any children).
dom.go:581
↓ 4 callers
Function
TagName
TagName returns the tag name of a Node. If it's not ElementNode, return empty string.
dom.go:164
↓ 3 callers
Function
DetachChild
(child *html.Node)
dom.go:598
↓ 3 callers
Function
PrependChild
PrependChild works like AppendChild() except it adds a node to the beginning of the list of children of a specified parent node.
dom.go:439
↓ 2 callers
Function
HasAttribute
HasAttribute returns a Boolean value indicating whether the specified node has the specified attribute or not.
dom.go:228
↓ 2 callers
Function
QuerySelector
QuerySelector returns the first document's element that match the specified group of selectors.
dom.go:32
↓ 2 callers
Function
ReplaceChild
ReplaceChild replaces a child node within the given (parent) node. If the new child is already exist in document, ReplaceChild() will move it from its
dom.go:456
↓ 2 callers
Function
SetTextContent
SetTextContent sets the text content of the specified node.
dom.go:534
↓ 2 callers
Function
TextContent
TextContent returns the text content of the specified node, and all its descendants.
dom.go:239
↓ 1 callers
Function
ChildNodes
ChildNodes returns list of a node's direct children.
dom.go:382
↓ 1 callers
Function
Children
Children returns an HTMLCollection of the direct child elements of Node.
dom.go:366
↓ 1 callers
Function
ClassName
ClassName returns the value of the class attribute of the specified element.
dom.go:358
↓ 1 callers
Function
Clone
Clone returns a clone of the node and (if specified) its children. However, it will be detached from the original's parents and siblings.
dom.go:486
↓ 1 callers
Function
CreateTextNode
CreateTextNode creates a new Text node.
dom.go:155
↓ 1 callers
Function
FirstElementChild
FirstElementChild returns the object's first child Element, or nil if there are no child elements.
dom.go:392
↓ 1 callers
Function
GetAllNodesWithTag
GetAllNodesWithTag is wrapper for GetElementsByTagName() which allow to get several tags at once.
dom.go:505
↓ 1 callers
Function
GetElementByID
GetElementByID returns a Node object representing the element whose id property matches the specified string.
dom.go:43
↓ 1 callers
Function
GetElementsByClassName
GetElementsByClassName returns an array of all child elements which have all of the given class name(s).
dom.go:77
↓ 1 callers
Function
ID
ID returns the value of the id attribute of the specified element.
dom.go:350
↓ 1 callers
Function
IncludeNode
IncludeNode determines if node is included inside nodeList.
dom.go:475
↓ 1 callers
Function
InnerHTML
InnerHTML returns the HTML content (inner HTML) of an element. The returned HTML value is escaped.
dom.go:321
↓ 1 callers
Function
NextElementSibling
NextElementSibling returns the Element immediately following the specified one in its parent's children list, or nil if the specified Element is the l
dom.go:416
↓ 1 callers
Function
PreviousElementSibling
PreviousElementSibling returns the the Element immediately prior to the specified one in its parent's children list, or null if the specified element
dom.go:404
↓ 1 callers
Function
QuerySelectorAll
QuerySelectorAll returns array of document's elements that match the specified group of selectors.
dom.go:21
↓ 1 callers
Function
RemoveAttribute
RemoveAttribute removes attribute with given name.
dom.go:210
↓ 1 callers
Function
RemoveNodes
RemoveNodes iterates over a NodeList, calls `filterFn` for each node and removes node if function returned `true`. If function is not passed, removes
dom.go:523
↓ 1 callers
Function
SetAttribute
SetAttribute sets attribute for node. If attribute already exists, it will be replaced.
dom.go:190
↓ 1 callers
Function
SetInnerHTML
SetInnerHTML sets inner HTML of the specified node.
dom.go:553
↓ 1 callers
Function
normalizeTextEncoding
normalizeTextEncoding convert text encoding from NFD to NFC. It also remove soft hyphen since apparently it's useless in web. See: https://web.archive
parser.go:56
Function
DocumentElement
DocumentElement returns the Element that is the root element of the document. Since we are working with HTML document, the root will be <html> element
dom.go:342
Function
FastParse
FastParse parses html.Node from the specified reader without caring about text encoding. It always assume that the input uses UTF-8 encoding.
parser.go:19
Function
ForEachNode
ForEachNode iterates over a NodeList and runs fn on each node.
dom.go:514
Function
InnerText
InnerText in JS used to capture text from an element while excluding text from hidden children. A child is hidden if it's computed width is 0, whether
dom.go:265
Function
Parse
Parse parses html.Node from the specified reader while converting the character encoding into UTF-8. This function is useful to correctly parse web pa
parser.go:28
Function
TestAppendChild
(t *testing.T)
dom_test.go:873
Function
TestChildNodes
(t *testing.T)
dom_test.go:705
Function
TestChildren
(t *testing.T)
dom_test.go:654
Function
TestClassName
(t *testing.T)
dom_test.go:617
Function
TestCloneNode
(t *testing.T)
dom_test.go:1066
Function
TestCreateElement
(t *testing.T)
dom_test.go:235
Function
TestCreateTextNode
(t *testing.T)
dom_test.go:284
Function
TestFirstElementChild
(t *testing.T)
dom_test.go:760
Function
TestGetAllNodesWithTag
(t *testing.T)
dom_test.go:1111
Function
TestGetAttribute
(t *testing.T)
dom_test.go:302
Function
TestGetElementByID
(t *testing.T)
dom_test.go:124
Function
TestGetElementsByClassName
(t *testing.T)
dom_test.go:159
Function
TestGetElementsByTagName
(t *testing.T)
dom_test.go:197
Function
TestHasAttribute
(t *testing.T)
dom_test.go:431
Function
TestId
(t *testing.T)
dom_test.go:588
Function
TestIncludeNode
(t *testing.T)
dom_test.go:1023
Function
TestInnerHTML
(t *testing.T)
dom_test.go:543
Function
TestNextElementSibling
(t *testing.T)
dom_test.go:834
Function
TestOuterHTML
(t *testing.T)
dom_test.go:508
Function
TestPrependChild
(t *testing.T)
dom_test.go:927
Function
TestPreviousElementSibling
(t *testing.T)
dom_test.go:795
Function
TestQuerySelector
(t *testing.T)
dom_test.go:64
Function
TestQuerySelectorAll
(t *testing.T)
dom_test.go:11
Function
TestRemoveAttribute
(t *testing.T)
dom_test.go:392
Function
TestRemoveNodes
(t *testing.T)
dom_test.go:1173
Function
TestReplaceChild
(t *testing.T)
dom_test.go:981
Function
TestSetAttribute
(t *testing.T)
dom_test.go:349
Function
TestSetInnerHTML
(t *testing.T)
dom_test.go:1268
Function
TestSetTextContent
(t *testing.T)
dom_test.go:1217
Function
TestTextContent
(t *testing.T)
dom_test.go:463