MDN self-hosted library · e01.org

ProcessingInstruction: hasAttributes() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const pi = document.createProcessingInstruction("start", 'name="placeholder"');

const pi2 = document.createProcessingInstruction("start", "");

console.log(pi.hasAttributes());
console.log(pi2.hasAttributes());
// logs:
// true
// false