Skip to content

Commit 4f041e4

Browse files
committed
make sure dir attribute is parsed if provided
1 parent ec68005 commit 4f041e4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/tests/dom/element.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<script src="../testing.js"></script>
33

4-
<div id="content">
4+
<div id="content" dir="ltr">
55
<a id="link" href="foo" class="ok">OK</a>
66
<p id="para-empty" class="ok empty">
77
<span id="para-empty-child"></span>
@@ -52,24 +52,24 @@
5252

5353
<script id=attributes>
5454
testing.expectEqual(true, content.hasAttributes());
55-
testing.expectEqual(1, content.attributes.length);
56-
testing.expectEqual(['id'], content.getAttributeNames());
55+
testing.expectEqual(2, content.attributes.length);
56+
testing.expectEqual(['id', 'dir'], content.getAttributeNames());
5757
testing.expectEqual('content', content.getAttribute('id'));
5858
testing.expectEqual('content', content.attributes['id'].value);
5959

6060
let x = '';
6161
for (const attr of content.attributes) {
62-
x += attr.name + '=' + attr.value;
62+
x += attr.name + '=' + attr.value + ',';
6363
}
64-
testing.expectEqual('id=content', x);
64+
testing.expectEqual('id=content,dir=ltr,', x);
6565

6666
testing.expectEqual(false, content.hasAttribute('foo'));
6767
testing.expectEqual(null, content.getAttribute('foo'));
6868

6969
content.setAttribute('foo', 'bar');
7070
testing.expectEqual(true, content.hasAttribute('foo'));
7171
testing.expectEqual('bar', content.getAttribute('foo'));
72-
testing.expectEqual(['id', 'foo'], content.getAttributeNames());
72+
testing.expectEqual(['id', 'dir', 'foo'], content.getAttributeNames());
7373

7474
testing.expectError('Error: InvalidCharacterError', () => {
7575
content.setAttribute('.foo', 'invalid')
@@ -266,7 +266,7 @@
266266

267267
<script id=elementDir>
268268
const divElement = document.createElement("div");
269-
// Always initialized with empty string.
269+
// Always initialized with empty string if `dir` attribute not provided.
270270
testing.expectEqual("", divElement.dir);
271271

272272
divElement.dir = "ltr";

0 commit comments

Comments
 (0)