Make WordPress Core

Changeset 58656

Timestamp:
07/03/2024 05:05:46 PM (4 weeks ago)
Author:
dmsnell
Message:

HTML API: Implement the _reset insertion mode appropriately_ algorithm.

In order to add support for the SELECT and TABLE tags in the HTML Processor, it
needs to implement the HTML algorithm named "reset the insertion mode
appropriately".

This patch implements that algorithm to unblock the additional tag support. The
algorithm resets the parsing mode after specific state changes in complicated
situations where alternative rules are in effect (such as rules governing how
the parser handles tags found within a TABLE element).

Developed in https://github.com/WordPress/wordpress-develop/pull/6020
Discussed in https://core.trac.wordpress.org/ticket/61549

Props dmsnell, jonsurrell.
Fixes #61549.

Location:
trunk/src/wp-includes/html-api
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-processor-state.php

    r58631 r58656  
    217217
    218218    /**
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
    219230     * Tracks open elements while scanning HTML.
    220231     *
     
    272283     */
    273284    public $context_node = null;
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
    274296
    275297    /**
  • trunk/src/wp-includes/html-api/class-wp-html-processor.php

    r58588 r58656  
    21282128        $this->last_error = self::ERROR_UNSUPPORTED;
    21292129        throw new WP_HTML_Unsupported_Exception( 'Cannot reconstruct active formatting elements when advancing and rewinding is required.' );
     2130
     2131
     2132
     2133
     2134
     2135
     2136
     2137
     2138
     2139
     2140
     2141
     2142
     2143
     2144
     2145
     2146
     2147
     2148
     2149
     2150
     2151
     2152
     2153
     2154
     2155
     2156
     2157
     2158
     2159
     2160
     2161
     2162
     2163
     2164
     2165
     2166
     2167
     2168
     2169
     2170
     2171
     2172
     2173
     2174
     2175
     2176
     2177
     2178
     2179
     2180
     2181
     2182
     2183
     2184
     2185
     2186
     2187
     2188
     2189
     2190
     2191
     2192
     2193
     2194
     2195
     2196
     2197
     2198
     2199
     2200
     2201
     2202
     2203
     2204
     2205
     2206
     2207
     2208
     2209
     2210
     2211
     2212
     2213
     2214
     2215
     2216
     2217
     2218
     2219
     2220
     2221
     2222
     2223
     2224
     2225
     2226
     2227
     2228
     2229
     2230
     2231
     2232
     2233
     2234
     2235
     2236
     2237
     2238
     2239
     2240
     2241
     2242
     2243
     2244
     2245
     2246
     2247
     2248
     2249
     2250
     2251
     2252
     2253
     2254
     2255
     2256
     2257
     2258
     2259
     2260
     2261
     2262
     2263
     2264
     2265
     2266
     2267
     2268
     2269
     2270
     2271
     2272
     2273
     2274
     2275
     2276
     2277
     2278
     2279
     2280
     2281
     2282
     2283
     2284
     2285
     2286
     2287
     2288
     2289
     2290
     2291
     2292
     2293
     2294
     2295
     2296
     2297
     2298
     2299
     2300
     2301
     2302
     2303
     2304
     2305
     2306
     2307
     2308
     2309
     2310
     2311
     2312
    21302313    }
    21312314
Note: See TracChangeset for help on using the changeset viewer.