[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
HTML API: WP_HTML_Doctype_Info class
File Size: | 616 lines (25 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_HTML_Doctype_Info:: (2 methods):
__construct()
from_doctype_token()
Class: WP_HTML_Doctype_Info - X-Ref
Core class used by the HTML API to represent a DOCTYPE declaration.__construct(?string $name,?string $public_identifier,?string $system_identifier,bool $force_quirks_flag) X-Ref |
Constructor. This class should not be instantiated directly. Use the static {@see self::from_doctype_token} method instead. The arguments to this constructor correspond to the "DOCTYPE token" as defined in the HTML specification. > DOCTYPE tokens have a name, a public identifier, a system identifier, > and a force-quirks flag. When a DOCTYPE token is created, its name, public identifier, > and system identifier must be marked as missing (which is a distinct state from the > empty string), and the force-quirks flag must be set to off (its other state is on). param: string|null $name Name of the DOCTYPE. param: string|null $public_identifier Public identifier of the DOCTYPE. param: string|null $system_identifier System identifier of the DOCTYPE. param: bool $force_quirks_flag Whether the force-quirks flag is set for the token. |
from_doctype_token( string $doctype_html ) X-Ref |
Creates a WP_HTML_Doctype_Info instance by parsing a raw DOCTYPE declaration token. Use this method to parse a DOCTYPE declaration token and get access to its properties via the returned WP_HTML_Doctype_Info class instance. The provided input must parse properly as a DOCTYPE declaration, though it must not represent a valid DOCTYPE. Example: // Normative HTML DOCTYPE declaration. $doctype = WP_HTML_Doctype_Info::from_doctype_token( '<!DOCTYPE html>' ); 'no-quirks' === $doctype->indicated_compatability_mode; // A nonsensical DOCTYPE is still valid, and will indicate "quirks" mode. $doctype = WP_HTML_Doctype_Info::from_doctype_token( '<!doctypeJSON SILLY "nonsense\'>' ); 'quirks' === $doctype->indicated_compatability_mode; // Textual quirks present in raw HTML are handled appropriately. $doctype = WP_HTML_Doctype_Info::from_doctype_token( "<!DOCTYPE\nhtml\n>" ); 'no-quirks' === $doctype->indicated_compatability_mode; // Anything other than a proper DOCTYPE declaration token fails to parse. null === WP_HTML_Doctype_Info::from_doctype_token( ' <!DOCTYPE>' ); null === WP_HTML_Doctype_Info::from_doctype_token( '<!DOCTYPE ><p>' ); null === WP_HTML_Doctype_Info::from_doctype_token( '<!TYPEDOC>' ); null === WP_HTML_Doctype_Info::from_doctype_token( 'html' ); null === WP_HTML_Doctype_Info::from_doctype_token( '<?xml version="1.0" encoding="UTF-8" ?>' ); param: string $doctype_html The complete raw DOCTYPE HTML string, e.g. `<!DOCTYPE html>`. return: WP_HTML_Doctype_Info|null A WP_HTML_Doctype_Info instance will be returned if the |
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |