Problem/Motivation

When trying to get Views to output field wrapped in a <data> element it gets removed.

Steps to reproduce

  1. Create an element in Views using a <data> element (see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data)
  2. Wrapping element is removed

Proposed resolution

Add the "data" element to the Xss::$adminTags list.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

Issue fork drupal-3348218

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

minorOffense created an issue. See original summary.

minoroffense’s picture

Status: Active » Needs review
Related issues: +#2776667: Review/update $adminTags variable for new html elements to be allowed
StatusFileSize
new1.65 KB

Here's a patch to allow the element.

minoroffense’s picture

Issue summary: View changes
tanuj.’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new420.44 KB
new349.32 KB
new376.85 KB

Tested patch #2 with Drupal:10.1.x, patch applied successfully and solved the issue of <data> element getting removed in view.

adding screenshots of view element and before and after applying patch #2. RTBC +1

smustgrave’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs tests

Next step would be to add a test assertion for it also.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

acbramley’s picture

At least needs a reroll, a similar issue popped up today in slack #3443360: Xss::filterAdmin() to allow "dialog" - wondering what the use-case is for adding data elements?

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

Put the related issue into PNMI so think this should be too.

minoroffense’s picture

Status: Postponed (maintainer needs more info) » Needs work

We setup a view that outputs values into a table for time spent entries. The data element describes the value as seconds and the we use that to generate charts and other things.

Views strips the data element without the patch. We can’t use the raw number since we want to show the value in different formats. The display value is human friendly but the data element lets us bring along machine friendly info.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data

Prem Suthar made their first commit to this issue’s fork.

prem suthar’s picture

Re-rolled The patch by mr .

prem suthar’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Still needs tests

arunkumark made their first commit to this issue’s fork.

arunkumark’s picture

Assigned: Unassigned » arunkumark
Status: Needs work » Needs review

As per the comment #14 added test.

arunkumark’s picture

Assigned: arunkumark » Unassigned
smustgrave’s picture

Status: Needs review » Needs work

Was actually thinking of actual filtering tests, like in XssTest.php

arunkumark’s picture

@smustgrave Do we require XssTest.php kind of test for an additional <data> tag? Because additional tags like cite, code, quote are added in the Admin Filter test only on FilterAdminTest.php.

duaelfr’s picture

Status: Needs work » Closed (duplicate)