@@ -32,17 +32,19 @@ module HTML {
32
32
/**
33
33
* Holds if this is a toplevel element, that is, if it does not have a parent element.
34
34
*/
35
- predicate isTopLevel ( ) { not exists ( getParent ( ) ) }
35
+ predicate isTopLevel ( ) { not exists ( this . getParent ( ) ) }
36
36
37
37
/**
38
38
* Gets the root HTML document element in which this element is contained.
39
39
*/
40
- DocumentElement getDocument ( ) { result = getRoot ( ) }
40
+ DocumentElement getDocument ( ) { result = this . getRoot ( ) }
41
41
42
42
/**
43
43
* Gets the root element in which this element is contained.
44
44
*/
45
- Element getRoot ( ) { if isTopLevel ( ) then result = this else result = getParent ( ) .getRoot ( ) }
45
+ Element getRoot ( ) {
46
+ if this .isTopLevel ( ) then result = this else result = this .getParent ( ) .getRoot ( )
47
+ }
46
48
47
49
/**
48
50
* Gets the `i`th child element (0-based) of this element.
@@ -52,7 +54,7 @@ module HTML {
52
54
/**
53
55
* Gets a child element of this element.
54
56
*/
55
- Element getChild ( ) { result = getChild ( _) }
57
+ Element getChild ( ) { result = this . getChild ( _) }
56
58
57
59
/**
58
60
* Gets the `i`th attribute (0-based) of this element.
@@ -62,13 +64,13 @@ module HTML {
62
64
/**
63
65
* Gets an attribute of this element.
64
66
*/
65
- Attribute getAnAttribute ( ) { result = getAttribute ( _) }
67
+ Attribute getAnAttribute ( ) { result = this . getAttribute ( _) }
66
68
67
69
/**
68
70
* Gets an attribute of this element that has the given name.
69
71
*/
70
72
Attribute getAttributeByName ( string name ) {
71
- result = getAnAttribute ( ) and
73
+ result = this . getAnAttribute ( ) and
72
74
result .getName ( ) = name
73
75
}
74
76
@@ -77,7 +79,7 @@ module HTML {
77
79
*/
78
80
TextNode getTextNode ( ) { result .getParent ( ) = this }
79
81
80
- override string toString ( ) { result = "<" + getName ( ) + ">...</>" }
82
+ override string toString ( ) { result = "<" + this . getName ( ) + ">...</>" }
81
83
}
82
84
83
85
/**
@@ -106,7 +108,7 @@ module HTML {
106
108
* Gets the root element in which the element to which this attribute
107
109
* belongs is contained.
108
110
*/
109
- Element getRoot ( ) { result = getElement ( ) .getRoot ( ) }
111
+ Element getRoot ( ) { result = this . getElement ( ) .getRoot ( ) }
110
112
111
113
/**
112
114
* Gets the name of this attribute.
@@ -121,7 +123,7 @@ module HTML {
121
123
*/
122
124
string getValue ( ) { xmlAttrs ( this , _, _, result , _, _) }
123
125
124
- override string toString ( ) { result = getName ( ) + "=" + getValue ( ) }
126
+ override string toString ( ) { result = this . getName ( ) + "=" + this . getValue ( ) }
125
127
}
126
128
127
129
/**
@@ -138,7 +140,7 @@ module HTML {
138
140
* ```
139
141
*/
140
142
class DocumentElement extends Element {
141
- DocumentElement ( ) { getName ( ) = "html" }
143
+ DocumentElement ( ) { this . getName ( ) = "html" }
142
144
}
143
145
144
146
/**
@@ -155,7 +157,7 @@ module HTML {
155
157
class TextNode extends Locatable , @xmlcharacters {
156
158
TextNode ( ) { exists ( HtmlFile f | xmlChars ( this , _, _, _, _, f ) ) }
157
159
158
- override string toString ( ) { result = getText ( ) }
160
+ override string toString ( ) { result = this . getText ( ) }
159
161
160
162
/**
161
163
* Gets the content of this text node.
@@ -198,7 +200,7 @@ module HTML {
198
200
Element getParent ( ) { xmlComments ( this , _, result , _) }
199
201
200
202
/** Gets the text of this comment, not including delimiters. */
201
- string getText ( ) { result = toString ( ) .regexpCapture ( "(?s)<!--(.*)-->" , 1 ) }
203
+ string getText ( ) { result = this . toString ( ) .regexpCapture ( "(?s)<!--(.*)-->" , 1 ) }
202
204
203
205
override string toString ( ) { xmlComments ( this , result , _, _) }
204
206
0 commit comments