mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[test] test case for element.dataset
This commit is contained in:
parent
fbbba38b8a
commit
a7bf39e9a6
25
test/ecmascript/assert/element.dataset.html
Normal file
25
test/ecmascript/assert/element.dataset.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<div id="a" data-a="1" data-b="abc" data-cd="123"></div>
|
||||
|
||||
<button onclick="myFunction()">Try it</button>
|
||||
|
||||
<p id="demo"></p>
|
||||
|
||||
<script>
|
||||
function myFunction() {
|
||||
var div = document.getElementById('a');
|
||||
console.assert(div.dataset.b === 'abc', 'abc');
|
||||
div.dataset.b = '123';
|
||||
console.assert(div.dataset.b === '123', '123');
|
||||
}
|
||||
|
||||
console.error('element.dataset.html');
|
||||
myFunction();
|
||||
console.exit();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user