Mercurial > hg > cmmr2012-drupal-site
view vendor/jcalderonzumba/mink-phantomjs-driver/src/Resources/Script/is_checked.js.twig @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
line wrap: on
line source
{% autoescape 'js' %} (function (xpath) { function getElement(xpath, within) { var result; if (within === null || within === undefined) { within = document; } result = document.evaluate(xpath, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (result.snapshotLength !== 1) { return null; } return result.snapshotItem(0); } var node = getElement(xpath); if (node === null) { return null; } if(node.tagName.toLowerCase() != "input"){ return null; } if(node.type.toLowerCase() != "checkbox" && node.type.toLowerCase() != "radio"){ return null; } return node.checked; }('{{ xpath }}')); {% endautoescape %}