-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:after not working for attributes #167
Comments
Yes, you can do this but with a slightly different syntax. You can read the current value for the class attribute and concatenate it:
But yes, perhaps this would be a useful addition |
Strange, |
It doesn't work if
|
These tests pass fine for me: public function testConcatDataAndAttr() {
$data = ['class' => ' AFTER'];
$xml = '<h1 class="foo">Example Title</h1>';
$tss = 'h1:attr(class) {content: attr(class) + data(class); }';
$template = new \Transphporm\Builder($xml, $tss);
$this->assertEquals($this->stripTabs('<h1 class="foo AFTER">Example Title</h1>'),
$this->stripTabs($template->output($data)->body));
}
public function testConcatDataAndAttr2() {
$data = ['class' => ' AFTER'];
$xml = '<h1 class="foo">Example Title</h1>';
$tss = 'h1:attr(class) {content: attr(class), data(class); }';
$template = new \Transphporm\Builder($xml, $tss);
$this->assertEquals($this->stripTabs('<h1 class="foo AFTER">Example Title</h1>'),
$this->stripTabs($template->output($data)->body));
} |
This was fixed in the master branch, the current release supports the workaround using concatenation and the master branch and next release will support the syntax you described in the first post: h1:attr(class):after {content: data(class); } |
I would like to append to the class attribute, but the previous content is overwritten.
Expected output:
<h1 class="foo AFTER">Example Title</h1>
Given output:
<h1 class=" AFTER">Example Title</h1>
Alternatively it could be useful to be able to reference the current content of a selected element itself. Maybe with
h1:attr(class) {content: content(), " AFTER";}
The text was updated successfully, but these errors were encountered: