attributesParent - bhsd-harry/wikiparser-node GitHub Wiki
This is an internal document. For visitors, you can now go back to the home page.
// attributes (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
get attributes() {
return this.x;
}
set attributes(v) {
this.x = v;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.attributes, 0);
token.attributes = 1;
assert.strictEqual(token.attributes, 1);
// className (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
get className() {
return this.x;
}
set className(v) {
this.x = v;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.className, 0);
token.className = 1;
assert.strictEqual(token.className, 1);
// classList (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
get classList() {
return this.x;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.classList, 0);
// id (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
get id() {
return this.x;
}
set id(v) {
this.x = v;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.id, 0);
token.id = 1;
assert.strictEqual(token.id, 1);
// hasAttr (Node.js)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
hasAttr() {
return this.x;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.hasAttr(), 0);
// getAttr (Node.js)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
getAttr() {
return this.x;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.getAttr(), 0);
// getAttrNames (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
getAttrNames() {
return this.x;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.getAttrNames(), 0);
// getAttrs (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
getAttrs() {
return this.x;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.x = 1;
assert.strictEqual(token.getAttrs(), 0);
// setAttr (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
setAttr(v) {
this.x = v;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.setAttr(1);
assert.strictEqual(token.x, 0);
assert.strictEqual(token.childNodes[0].x, 1);
// removeAttr (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
removeAttr() {
this.x = 1;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.removeAttr();
assert.strictEqual(token.x, 0);
assert.strictEqual(token.childNodes[0].x, 1);
// toggleAttr (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
toggleAttr() {
this.x = 1;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.toggleAttr();
assert.strictEqual(token.x, 0);
assert.strictEqual(token.childNodes[0].x, 1);
// css (main)
var {attributesParent} = require('../mixin/attributesParent');
var AttributesParentBase, token;
class S {
x = 0;
css() {
this.x = 1;
}
}
AttributesParentBase = attributesParent()(S);
token = new AttributesParentBase();
token.childNodes = [new S()];
token.css();
assert.strictEqual(token.x, 0);
assert.strictEqual(token.childNodes[0].x, 1);