Mercurial > hg > isophonics-drupal-site
view vendor/jcalderonzumba/mink-phantomjs-driver/src/Resources/Script/is_checked.js.twig @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +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 %}