Skip to content

DocumentFragment missing getElementById() #14499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arjunyel opened this issue Mar 7, 2017 · 0 comments
Closed

DocumentFragment missing getElementById() #14499

arjunyel opened this issue Mar 7, 2017 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue

Comments

@arjunyel
Copy link

arjunyel commented Mar 7, 2017

TypeScript Version: 2.2.1

Code

class FragmentBug extends HTMLElement{
    constructor(){
        super();
        const shadowRoot = this.attachShadow({mode: 'open'});
        shadowRoot.innerHTML = `
            <div id="byid"></div>
        `;
        const p = document.createElement("p");
        this.shadowRoot.getElementById("byid").appendChild(p);
        /*ERROR: Property 'getElementById' does not exist on type 'ShadowRoot'.*/
     }
};
customElements.define('fragment-bug', FragmentBug);

Expected behavior:

ShadowRoot inherits getElementById() from DocumentFragment, which returns an Element, and appends a <p> tag to the <div>

MDN DocumentFragment

Actual behavior:

error TS2339: Property 'getElementById' does not exist on type 'ShadowRoot'.

@mhegazy mhegazy added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Mar 7, 2017
@zhengbli zhengbli reopened this Mar 11, 2017
@zhengbli zhengbli added the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label Mar 11, 2017
@mhegazy mhegazy self-assigned this Mar 22, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Mar 22, 2017
@zhengbli zhengbli removed the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label Mar 23, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants