Skip to content
Snippets Groups Projects

Toss an iframe in the initial configuration to throw monkey wrenches around.

Closed Luke Leber requested to merge issue/drupal-3410303:3410303-filterhtml-data-loss into 11.x
1 unresolved thread

Let's get a test running.. Closes #3410303

Merge request reports

Approval is optional
Code Quality is loading
Test summary results are being parsed
Ready to merge by members who can write to the target branch.

Merge details

  • 1 commit and 1 merge commit will be added to .
  • Source branch will not be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
579 579 $this->assertNormalized($f, '<a>link</a>', 'HTML filter removes allowed attributes that have a not explicitly allowed value.');
580 580 $f = (string) $filter->process('<a href="/beautiful-animals" kitten="cute" llama="epic majestical">link</a>', Language::LANGCODE_NOT_SPECIFIED);
581 581 $this->assertSame('<a href="/beautiful-animals" llama="epic majestical">link</a>', $f, 'HTML filter keeps explicitly allowed attributes with an attribute value that is also explicitly allowed.');
582
583 // Allow iframes and check that the subsequent tags are parsed correctly.
584 $filter->setConfiguration([
585 'settings' => [
586 'allowed_html' => '<iframe> <a href llama>',
587 'filter_html_help' => 1,
588 'filter_html_nofollow' => 0,
589 ],
590 ]);
591 $f = (string) $filter->process('<a kitten="cute" llama="awesome">link</a>', Language::LANGCODE_NOT_SPECIFIED);
592 $this->assertNormalized($f, '<a llama="awesome">link</a>');
  • Comment on lines +582 to +592

    It might be worth expanding the test cases to check iframe-like-elements too (<map>, <object>, etc..). Iframes are just the first one I stepped on.

  • Please register or sign in to reply
  • Dave Long added 2 commits

    added 2 commits

    • 53150150 - Use regex instead of HTML DOM to parse allowed tags.
    • fa557517 - Add unit test coverage for a second attribute.

    Compare with previous version

  • Dave Long added 1 commit

    added 1 commit

    • 2521c51d - Allow more characters in regex.

    Compare with previous version

  • Dave Long added 1 commit

    added 1 commit

    • 19f657e9 - Revert "Add unit test coverage for a second attribute."

    Compare with previous version

  • Dave Long added 2 commits

    added 2 commits

    Compare with previous version

  • Dave Long added 1 commit

    added 1 commit

    Compare with previous version

  • Dave Long added 1 commit

    added 1 commit

    • 79d26512 - Revert "Improve regex further."

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading