22 lines
591 B
JavaScript
22 lines
591 B
JavaScript
import { SwapNode } from "./swapnode.js";
|
|
import { PropertyReader } from "../propertyreader.js";
|
|
|
|
export class PropertyNode extends SwapNode {
|
|
constructor(node, swapNode, propertyReader) {
|
|
super(node, swapNode);
|
|
|
|
if (!(propertyReader instanceof PropertyReader))
|
|
throw TypeError("propertyReader must be an instance of `PropertyReader`");
|
|
|
|
this.propertyReader = propertyReader;
|
|
|
|
super.replaceNodes();
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
linker(node, swapNode) {
|
|
this.properties = this.propertyReader.read(node.innerText);
|
|
}
|
|
} |