Mac Developer Library

Developer

WebKit Framework Reference DOMHTMLDocument Additions Reference

Options
Deployment Target:

On This Page
Language:

DOMHTMLDocument

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import WebKit

Objective-C

@import WebKit;

Availability


Available in OS X v10.5 and later.

Additions to the DOMHTMLDocument class to create document fragments.

  • Creates a document fragment containing the given HTML markup.

    Declaration

    Swift

    func createDocumentFragmentWithMarkupString(_ markupString: String!, baseURL baseURL: NSURL!) -> DOMDocumentFragment!

    Objective-C

    - (DOMDocumentFragment *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL

    Parameters

    markupString

    The HTML content to parse into a DOM tree.

    baseURL

    The URI from which the content originated. Used for interpreting relative URLs.

    Return Value

    A DOMDocumentFragment derived from the original markup string.

    Discussion

    This is a convenience method for the createDocumentFragment method in DOMDocument. It creates a fragment that has the HTML markup parsed into child nodes of the fragment using the baseURL to resolve any relative paths for images or other resources.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.5 and later.

  • Creates a document fragment containing the given text.

    Declaration

    Swift

    func createDocumentFragmentWithText(_ text: String!) -> DOMDocumentFragment!

    Objective-C

    - (DOMDocumentFragment *)createDocumentFragmentWithText:(NSString *)text

    Parameters

    text

    The text to convert.

    Return Value

    A DOMDocumentFragment object derived from the source text.

    Discussion

    This is a convenience method for the createDocumentFragment method in DOMDocument. This method creates a fragment that contains the supplied plain text.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.5 and later.