Skip to content

Utilize new data-amp-bind-* alternative syntax for amp-bind attributes #1162

@westonruter

Description

@westonruter

There is a new XHTML-compatible amp-bind attribute syntax: ampproject/amphtml#11115 via ampproject/amphtml#15408

Instead of:

<span class="foo" [class]="foo ? 'foo' : 'bar'">

We can now do:

<span class="foo" data-amp-bind-class="foo ? 'foo' : 'bar'">

What this means is that we now have an official way of representing amp-bind attributes in PHP's DOM internals. We can now eliminate AMP_DOM_Utils::get_amp_bind_placeholder_prefix() and AMP_DOM_Utils::restore_amp_bind_attributes() entirely, and AMP_DOM_Utils::convert_amp_bind_attributes() can be modified to just convert the bracketed syntax into the data-amp-bind-* syntax. There would be no need to restore the bracketed syntax when re-serializing. The result will be improved performance.

Metadata

Metadata

Assignees

Labels

EnhancementNew feature or improvement of an existing oneSanitizers

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions