Skip to content

Commit

Permalink
feat: add additional aliases rih, roh, rtc
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Mar 16, 2017
1 parent 49ed223 commit 3615252
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ Surgeon exports an alias preset is used to reduce verbosity of the queries.
|Name|Description|
|---|---|
|`ra ...`|Reads Element attribute value. Equivalent to `read attribute ...`|
|`rih ...`|Reads `innerHTML` property of an element. Equivalent to `read property ... innerHTML`|
|`roh ...`|Reads `outerHTML` property of an element. Equivalent to `read property ... outerHTML`|
|`rp ...`|Reads Element property value. Equivalent to `read property ...`|
|`rtc ...`|Reads `textContent` property of an element. Equivalent to `read property ... textContent`|
|`s ...`|Selects a single element. Equivalent to `select "..." {1}`.|
|`sm ...`|Selects multiple elements. Equivalent to `select "..." {0,}`|
|`t {name}`|Tests value. Equivalent to `test ...`|
Expand Down
9 changes: 9 additions & 0 deletions src/subroutineAliasPreset.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ export default {
ra: (subject, values, bindle) => {
return readSubroutine(subject, ['attribute'].concat(values), bindle);
},
rih: (subject, values, bindle) => {
return readSubroutine(subject, ['property', 'innerHTML'], bindle);
},
roh: (subject, values, bindle) => {
return readSubroutine(subject, ['property', 'outerHTML'], bindle);
},
rp: (subject, values, bindle) => {
return readSubroutine(subject, ['property'].concat(values), bindle);
},
rtc: (subject, values, bindle) => {
return readSubroutine(subject, ['property', 'textContent'], bindle);
},
s: (subject, values, bindle) => {
return selectSubroutine(subject, [values.join(' '), '{1}'], bindle);
},
Expand Down

0 comments on commit 3615252

Please sign in to comment.