Example 1 — Feature Detect xmlEncoding
Many modern engines omit this deprecated property entirely.
const supported = "xmlEncoding" in document;
console.log(supported);
if (supported) {
console.log(document.xmlEncoding);
} else {
console.log("xmlEncoding not available");
} How It Works
- Use
in. Safer than reading a removed property. - Expect gaps. Firefox removed it; others may omit it too.
- Do not polyfill. There is nothing useful to restore.
- Migrate intent. Use
characterSetfor encoding.

