Skip to content
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

#name:attr():data[var="val"] {} fails #230

Open
cj-clx opened this issue Mar 9, 2020 · 2 comments
Open

#name:attr():data[var="val"] {} fails #230

cj-clx opened this issue Mar 9, 2020 · 2 comments

Comments

@cj-clx
Copy link

cj-clx commented Mar 9, 2020

Somewhere between the 1.4 release from last November and the current head of dev-master, this stopped working:

<?php
require "vendor/autoload.php";

$tss = <<<TSS
#list-claims-form:attr(action):data[input.alternate!="alternate"] {
    content: "/list-claims";
}
#list-claims-form:attr(action):data[input.alternate="alternate"] {
    content: "/list-claims/alternate";
}
TSS;

$xml = '<form id="list-claims-form" action="FOOBAR">';

$data = [];
$data["input"] = [];

$template = new Transphporm\Builder($xml, $tss);
$output = $template->output($data)->body;
echo $output . PHP_EOL;

Expected output:

<form id="list-claims-form" action="/list-claims"></form>

Actual output:

<form id="list-claims-form" action="/list-claims/alternate"></form>
@cj-clx
Copy link
Author

cj-clx commented Mar 9, 2020

Note 1

Strangely, this does work:

<?php
require "vendor/autoload.php";

$tss = <<<TSS
#list-claims-form:attr(action):data[input.alternate!="alternate"] {
    content: "/list-claims";
}
/*
#list-claims-form:attr(action):data[input.alternate="alternate"] {
    content: "/list-claims/alternate";
}
*/
#list-claims-form:data[input.alternate="alternate"]:attr(action) {
    content: "/list-claims/alternate";
}
TSS;


$xml = '<form id="list-claims-form" action="FOOBAR">';


$data = [];
$data["input"] = [];

$template = new Transphporm\Builder($xml, $tss);
$output = $template->output($data)->body;
echo $output . PHP_EOL;

That is, the difference is this (in the false side of the branch):

#list-claims-form:attr(action):data[input.alternate="alternate"] { }

Versus this:

#list-claims-form:data[input.alternate="alternate"]:attr(action) { }

@cj-clx
Copy link
Author

cj-clx commented Mar 9, 2020

Is the failing syntax perhaps just plain wrong? Does the attr() specifier have to come after the data[] specifier all the time, perhaps?

@cj-clx cj-clx changed the title False check fails in dev-master #name:attr():data[var="value"] {} conditional failes Mar 10, 2020
@cj-clx cj-clx changed the title #name:attr():data[var="value"] {} conditional failes #name:attr():data[var="val"] {} fails Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant