wp/wp-includes/html-api/class-wp-html-token.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    59 	 * @var bool
    59 	 * @var bool
    60 	 */
    60 	 */
    61 	public $has_self_closing_flag = false;
    61 	public $has_self_closing_flag = false;
    62 
    62 
    63 	/**
    63 	/**
       
    64 	 * Indicates if the element is an HTML element or if it's inside foreign content.
       
    65 	 *
       
    66 	 * @since 6.7.0
       
    67 	 *
       
    68 	 * @var string 'html', 'svg', or 'math'.
       
    69 	 */
       
    70 	public $namespace = 'html';
       
    71 
       
    72 	/**
       
    73 	 * Indicates which kind of integration point the element is, if any.
       
    74 	 *
       
    75 	 * @since 6.7.0
       
    76 	 *
       
    77 	 * @var string|null 'math', 'html', or null if not an integration point.
       
    78 	 */
       
    79 	public $integration_node_type = null;
       
    80 
       
    81 	/**
    64 	 * Called when token is garbage-collected or otherwise destroyed.
    82 	 * Called when token is garbage-collected or otherwise destroyed.
    65 	 *
    83 	 *
    66 	 * @var callable|null
    84 	 * @var callable|null
    67 	 */
    85 	 */
    68 	public $on_destroy = null;
    86 	public $on_destroy = null;
    70 	/**
    88 	/**
    71 	 * Constructor - creates a reference to a token in some external HTML string.
    89 	 * Constructor - creates a reference to a token in some external HTML string.
    72 	 *
    90 	 *
    73 	 * @since 6.4.0
    91 	 * @since 6.4.0
    74 	 *
    92 	 *
    75 	 * @param string   $bookmark_name         Name of bookmark corresponding to location in HTML where token is found.
    93 	 * @param string|null   $bookmark_name         Name of bookmark corresponding to location in HTML where token is found,
    76 	 * @param string   $node_name             Name of node token represents; if uppercase, an HTML element; if lowercase, a special value like "marker".
    94 	 *                                             or `null` for markers and nodes without a bookmark.
    77 	 * @param bool     $has_self_closing_flag Whether the source token contains the self-closing flag, regardless of whether it's valid.
    95 	 * @param string        $node_name             Name of node token represents; if uppercase, an HTML element; if lowercase, a special value like "marker".
    78 	 * @param callable $on_destroy            Function to call when destroying token, useful for releasing the bookmark.
    96 	 * @param bool          $has_self_closing_flag Whether the source token contains the self-closing flag, regardless of whether it's valid.
       
    97 	 * @param callable|null $on_destroy            Optional. Function to call when destroying token, useful for releasing the bookmark.
    79 	 */
    98 	 */
    80 	public function __construct( $bookmark_name, $node_name, $has_self_closing_flag, $on_destroy = null ) {
    99 	public function __construct( ?string $bookmark_name, string $node_name, bool $has_self_closing_flag, ?callable $on_destroy = null ) {
    81 		$this->bookmark_name         = $bookmark_name;
   100 		$this->bookmark_name         = $bookmark_name;
       
   101 		$this->namespace             = 'html';
    82 		$this->node_name             = $node_name;
   102 		$this->node_name             = $node_name;
    83 		$this->has_self_closing_flag = $has_self_closing_flag;
   103 		$this->has_self_closing_flag = $has_self_closing_flag;
    84 		$this->on_destroy            = $on_destroy;
   104 		$this->on_destroy            = $on_destroy;
    85 	}
   105 	}
    86 
   106