Make WordPress Core


Ignore:
Timestamp:
05/17/2021 09:03:56 PM (5 years ago)
Author:
SergeyBiryukov
Message:

KSES: Allow calc() and var() values to be used in inline CSS.

Props aristath, displaynone, joyously, olafklejnstrupjensen, sabernhardt, jamesbonham, poena.
Fixes #46197, #46498.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/kses.php

    r49697 r50923  
    12131213         *
    12141214         * @ticket 45067
     1215         * @ticket 46197
     1216         * @ticket 46498
    12151217         *
    12161218         * @param $input string The style attribute saved in the editor.
     
    12881290                        ),
    12891291
     1292                        // CSS calc().
     1293                        array(
     1294                                'width: calc(2em + 3px)',
     1295                                'width: calc(2em + 3px)',
     1296                        ),
     1297
     1298                        // CSS variable.
     1299                        array(
     1300                                'padding: var(--wp-var1) var(--wp-var2)',
     1301                                'padding: var(--wp-var1) var(--wp-var2)',
     1302                        ),
     1303
     1304                        // CSS calc() with var().
     1305                        array(
     1306                                'margin-top: calc(var(--wp-var1) * 3 + 2em)',
     1307                                'margin-top: calc(var(--wp-var1) * 3 + 2em)',
     1308                        ),
     1309
    12901310                        /*
    12911311                         * Invalid use cases.
     
    13491369                        array(
    13501370                                'background-image: url( "http://example.com );',
     1371                                '',
     1372                        ),
     1373
     1374                        // Malformed calc, no closing `)`.
     1375                        array(
     1376                                'width: calc(3em + 10px',
     1377                                '',
     1378                        ),
     1379
     1380                        // Malformed var, no closing `)`.
     1381                        array(
     1382                                'width: var(--wp-var1',
    13511383                                '',
    13521384                        ),
Note: See TracChangeset for help on using the changeset viewer.