[wp-trac] [WordPress Trac] #58974: Modernize wp-embed script to remove IE≤11 code and support for WP<4.4
WordPress Trac
noreply at wordpress.org
Thu Aug 3 18:46:08 UTC 2023
#58974: Modernize wp-embed script to remove IE≤11 code and support for WP<4.4
-------------------------+--------------------
Reporter: westonruter | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.4
Component: Embeds | Version: 4.4
Severity: normal | Keywords:
Focuses: javascript |
-------------------------+--------------------
In the course of making the `wp-embed` script use the `defer` loading
strategy (#58931), I found that there was some old code for IE10/IE11
which we can remove now since those browsers are longer supported. Also,
since they're not supported anymore we can freely make use of `URL`
instead of hacking URL parsing with `document.createElement('a')`.
Additionally, I noticed that the deprecated `substr()` string method is
being used which should be replaced with `substring()` or `slice()`.
Nevertheless, as I started modernizing the `wp-embed` codebase I started
running into another problem: the stipulation that `wp-embed.js` (and the
generated `wp-embed.min.js`) ''not'' have any ampersands. This came up in
#34698 for which r35708 notes:
> Embeds: Remove `&` characters from the inline embed JS.
>
> Older versions of WordPress will convert those `&` characters to
`&`, which makes for some non-functional JS. If folks are running an
older release, let's not make their lives more difficult than it already
is.
This was introduced in WordPress 4.4, so the older versions in mind are
WordPress 4.3 and below. At this time, according to
[https://wordpress.org/about/stats/ WordPress stats], all versions below
4.4 add up to 1.43% of the market share:
||= Version =||= Percentage =||
||4.3 || 0.22%||
||4.2 || 0.21%||
||4.1 || 0.19%||
||4.0 || 0.13%||
||3.9 || 0.14%||
||3.8 || 0.07%||
||3.7 || 0.02%||
||3.6 || 0.08%||
||3.5 || 0.11%||
||3.4 || 0.07%||
||3.3 || 0.05%||
||3.2 || 0.03%||
||3.1 || 0.04%||
||3.0 || 0.07%||
||SUM: || '''1.43%'''||
So it seems the relevant changes for that ticket (r35708, r35762, and
later r50441) can be safely reverted now and the use of ampersands can be
allowed again in `wp-embed`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58974>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list