Cms: Class attribute cannot be removed via the |attr filter

Created on 7 Dec 2020  路  2Comments  路  Source: craftcms/cms

Description

This example from the docs for |attr does not appear to be working in Craft 3.5:

{% set tag = '<div class="foo">' %}
{{ tag|attr({class: false})|attr({class: 'bar'}) }}
{# Output: <div class="bar"> #}

Actual output: <div class="foo bar">

Additional info

  • Craft version: 3.5.16
  • PHP version: 7.1
bug

All 2 comments

Thanks for pointing that out! Just fixed this for the next release.

Craft 3.5.17 is out now with this fix.

Was this page helpful?
0 / 5 - 0 ratings