★ wanayoo — archive 1999 https://developer.mozilla.org/pl/docs/Web/API/Document/createProcessingInstructionNouvelle recherche | Portail wanayoo
mozilla
Wyniki wyszukiwania

    Document.createProcessingInstruction()

    Nasi wolontariusze nie przetłumaczyli jeszcze tego artykułu na język Polski. Dołącz do nas i pomóż go przetłumaczyć!

    createProcessingInstruction() creates a new processing instruction node, and returns it.

    Syntax

    Processing instruction node = document.createProcessingInstruction(target, data) 
    

    Parameters

    • Processing Instruction node is a ProcessingInstruction node.
    • target refers to the target part of the processing instruction node (i.e., <?target ... ?>
    • data is a string containing the data to be added to the data within the node.

    Exceptions

    NOT_SUPPORTED_ERR
    Thrown if you attempt to create a processing instruction node on an HTML document in Gecko 9 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) or earlier. In Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) and later, you can use this method on HTML documents.
    DOM_INVALID_CHARACTER
    Thrown if you try to add an invalid processing instruction target (it should be an XML name besides any case combination of the letters "xml") or if the closing processing instruction sequence ("?>") is added as part of the data, so unescaped user-provided data cannot be safely used without escaping or otherwise dealing with such situations.

    Example

    var docu = new DOMParser().parseFromString('<xml></xml>',  "application/xml")
    
    var pi = docu.createProcessingInstruction('xml-stylesheet', 'href="/old?u=https%3A%2F%2Fdeveloper.mozilla.org%2Fpl%2Fdocs%2FWeb%2FAPI%2FDocument%2Fmycss.css&y=1999" type="text/css"');
    
    docu.insertBefore(pi, docu.firstChild);
    
    alert(new XMLSerializer().serializeToString(docu));
    // Displays: <?xml-stylesheet href="/old?u=https%3A%2F%2Fdeveloper.mozilla.org%2Fpl%2Fdocs%2FWeb%2FAPI%2FDocument%2Fmycss.css&y=1999" type="text/css"?><xml/>
    

    Specifications

    DOM 4: createProcessingInstruction

    Autorzy i etykiety dokumentu

    Contributors to this page: Sheppy, Zcorpan, dbruant, Brettz9, kscarfone, teoli, Krinkle
    Ostatnia aktualizacja: teoli,
    Ukryj panel boczny