nodeName returns the node name of the given html node. See NodeName for additional details on behaviour.
(node *html.Node)
| 42 | // nodeName returns the node name of the given html node. |
| 43 | // See NodeName for additional details on behaviour. |
| 44 | func nodeName(node *html.Node) string { |
| 45 | if node == nil { |
| 46 | return "" |
| 47 | } |
| 48 | |
| 49 | switch node.Type { |
| 50 | case html.ElementNode, html.DoctypeNode: |
| 51 | return node.Data |
| 52 | default: |
| 53 | if int(node.Type) < len(nodeNames) { |
| 54 | return nodeNames[node.Type] |
| 55 | } |
| 56 | return "" |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // Render renders the HTML of the first item in the selection and writes it to |
| 61 | // the writer. It behaves the same as OuterHtml but writes to w instead of |
no outgoing calls
no test coverage detected
searching dependent graphs…