I’m trying to make a conditional checker check whether the element has any attributes or not.
var result = parentElm.hasAttribute();
i tried using this but I’m not sure I want a specific attribute by name, I just want to check whether the element has any attributes or attribute like length, size, or idk.
copyFormatCommand.js
const model = this.editor.model;
const selection = model.document.selection;
const parentElm = selection.focus.parent;
this.isEnabled = !!parentElm;
Here is the HTML I’m using to test if there are multiple nested elements and want to check whether the textNode
‘s parent element has any attributes
HTML
<p style="font: 11pt Times New Roman, Times, Serif; margin: 0;" xvid="c0fc3b7176d15af5d8c5c488a7fa675e"><span xvid="6f8db94eb5824fc90d39a2d9a127a98d">Annual Fund Operating Expenses</span></p>
<p style="font: 11pt Times New Roman, Times, Serif; margin: 0;" xvid="c0fc3b7176d15af5d8c5c488a7fa675e">
<span xvid="6f8db94eb5824fc90d39a2d9a127a98d"><span xvid="1">hello</span></span>
</p>
<p>hello</p>