fix(): generate id
This commit is contained in:
parent
367f3a08bc
commit
5b7dacfd08
|
@ -68,6 +68,8 @@ class NodeId implements NodeIdInterface {
|
||||||
if (isNodeEntry(root) && root.fragment) {
|
if (isNodeEntry(root) && root.fragment) {
|
||||||
root = root.fragment;
|
root = root.fragment;
|
||||||
}
|
}
|
||||||
|
const element = (isNode(root) ? root : root.get<Element>()) as Element;
|
||||||
|
if (element.nodeType === Node.TEXT_NODE) return;
|
||||||
const nodes =
|
const nodes =
|
||||||
(isNode(root) ? root : root.get<Element>())?.querySelectorAll(
|
(isNode(root) ? root : root.get<Element>())?.querySelectorAll(
|
||||||
tagNames,
|
tagNames,
|
||||||
|
@ -88,6 +90,7 @@ class NodeId implements NodeIdInterface {
|
||||||
*/
|
*/
|
||||||
generate(node: Node | NodeInterface, force: boolean = false) {
|
generate(node: Node | NodeInterface, force: boolean = false) {
|
||||||
if (isNode(node)) node = $(node);
|
if (isNode(node)) node = $(node);
|
||||||
|
if (node.isText()) return;
|
||||||
const rules = this.#rules;
|
const rules = this.#rules;
|
||||||
// 不符合规则
|
// 不符合规则
|
||||||
const nodeRules = rules[node.name];
|
const nodeRules = rules[node.name];
|
||||||
|
|
Loading…
Reference in New Issue