Skip to content

Commit

Permalink
ENH Use generic JavaScript for selecting HTML content
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Mar 6, 2025
1 parent 20730c3 commit 35f1512
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/Context/FixtureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -989,20 +989,8 @@ protected function selectInTheHtmlField(string $select, string $field)
$inputField->getParent()->find('css', 'iframe')->click();
$inputFieldId = $inputField->getAttribute('id');
$js = <<<JS
var editor = jQuery('#$inputFieldId').entwine('ss').getEditor(),
doc = editor.getInstance().getDoc(),
sel = doc.getSelection(),
rng = new Range(),
matched = false;
jQuery(doc).find("$select").each(function() {
if(!matched) {
rng.selectNode(this);
sel.removeAllRanges();
sel.addRange(rng);
matched = true;
}
});
const editor = jQuery('#$inputFieldId').entwine('ss').getEditor();
editor.selectByCssSelector("$select");
JS;
$this->getMainContext()->getSession()->executeScript($js);
}
Expand Down

0 comments on commit 35f1512

Please sign in to comment.