/
Attr.cljs
127 lines (95 loc) · 3.37 KB
/
Attr.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
(ns web.Attr
"The Attr interface represents one of a DOM element's attributes
an object. In most DOM methods, you will directly retrieve the
as a string (e.g., `Element.getAttribute()`), but certain functions
`Element.getAttributeNode()`) or means of iterating return Attr"
(:refer-clojure :exclude [name]))
(defn name
"Property.
The attribute's name."
[this]
(-> this (.-name)))
(defn set-name!
"Property.
The attribute's name."
[this val]
(aset this "name" val))
(defn namespace-uri
"Property.
[Read Only]
The Attr.namespaceURI read-only property returns the namespace
of the attribute, or null if the element is not in a namespace.
`namespace = attribute.namespaceURI`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Attr/namespaceURI`"
[this]
(-> this (.-namespaceURI)))
(defn local-name
"Property.
[Read Only]
The Attr.localName read-only property returns the local part
the qualified name of an element.
`name = attribute.localName`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Attr/localName`"
[this]
(-> this (.-localName)))
(defn prefix
"Property.
[Read Only]
The Attr.prefix read-only property returns the namespace prefix
the specified attribute, or null if no prefix is specified.
`string = attribute.prefix`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Attr/prefix`"
[this]
(-> this (.-prefix)))
(defn owner-element
"Property.
The element holding the attribute.
Note: DOM Level 4 removed this property. The assumption was
since you get an Attr object from an Element, you should already
the associated element.
As that doesn't hold true in cases like Attr objects being returned
Document.evaluate, the DOM Living Standard reintroduced the property.
Gecko outputs a deprecation note starting from Gecko 7.0 (Firefox
/ Thunderbird 7.0 / SeaMonkey 2.4). This note was removed again
Gecko 49.0 (Firefox 49.0 / Thunderbird 49.0 / SeaMonkey 2.46)."
[this]
(-> this (.-ownerElement)))
(defn set-owner-element!
"Property.
The element holding the attribute.
Note: DOM Level 4 removed this property. The assumption was
since you get an Attr object from an Element, you should already
the associated element.
As that doesn't hold true in cases like Attr objects being returned
Document.evaluate, the DOM Living Standard reintroduced the property.
Gecko outputs a deprecation note starting from Gecko 7.0 (Firefox
/ Thunderbird 7.0 / SeaMonkey 2.4). This note was removed again
Gecko 49.0 (Firefox 49.0 / Thunderbird 49.0 / SeaMonkey 2.46)."
[this val]
(aset this "ownerElement" val))
(defn specified
"Property.
This property always returns true. Originally, it returned true
the attribute was explicitly specified in the source code or
a script, and false if its value came from the default one defined
the document's DTD."
[this]
(-> this (.-specified)))
(defn set-specified!
"Property.
This property always returns true. Originally, it returned true
the attribute was explicitly specified in the source code or
a script, and false if its value came from the default one defined
the document's DTD."
[this val]
(aset this "specified" val))
(defn value
"Property.
The attribute's value."
[this]
(-> this (.-value)))
(defn set-value!
"Property.
The attribute's value."
[this val]
(aset this "value" val))