PDFElement: composed property

Works in all major browsers
Since July 2026

WebPDF works in Chrome and Edge 125, Firefox 153 and Safari 18, on desktop and mobile, and in every later version: the oldest versions its PDF.js build supports, which already have every platform feature WebPDF needs. Since July 2026, that is every major browser.

The composed property of the PDFElement interface sets or returns whether the events of a <pdf-file> or <pdf-page> element cross shadow root boundaries.

Value

A boolean value. The default is true: like the events of built-in elements, WebPDF events are composed and reach listeners outside a shadow root the element is in. Set it to false to keep them inside. It is a property only; there is no attribute.

Page events bubble through a parent <pdf-file> too, so check event.target when you listen on a file.

Examples

Keeping events inside a component

js
class Viewer extends HTMLElement {
  constructor() {
    super();
    const root = this.attachShadow({ mode: "open" });
    root.innerHTML = `<pdf-file src=report.pdf><pdf-page></pdf-page></pdf-file>`;
    for (const el of root.querySelectorAll("pdf-file, pdf-page")) el.composed = false;
  }
}

Specifications

Not part of any specification. <pdf-file> and <pdf-page> are autonomous custom elements defined by WebPDF.pro.

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
composed
1251251531111812515383182712518

Legend

Full support

See also