How to use getFirstEquivalentPoint method in wpt

Best JavaScript code snippet using wpt

aryeh_implementation.js

Source:aryeh_implementation.js Github

copy

Full Screen

...3544 }3545 // "Return null."3546 return null;3547}3548function getFirstEquivalentPoint(node, offset) {3549 // "While (node, offset)'s previous equivalent point is not null, set3550 // (node, offset) to its previous equivalent point."3551 var prev;3552 while (prev = getPreviousEquivalentPoint(node, offset)) {3553 node = prev[0];3554 offset = prev[1];3555 }3556 // "Return (node, offset)."3557 return [node, offset];3558}3559function getLastEquivalentPoint(node, offset) {3560 // "While (node, offset)'s next equivalent point is not null, set (node,3561 // offset) to its next equivalent point."3562 var next;3563 while (next = getNextEquivalentPoint(node, offset)) {3564 node = next[0];3565 offset = next[1];3566 }3567 // "Return (node, offset)."3568 return [node, offset];3569}3570//@}3571///// Block-extending a range /////3572//@{3573// "A boundary point (node, offset) is a block start point if either node's3574// parent is null and offset is zero; or node has a child with index offset −3575// 1, and that child is either a visible block node or a visible br."3576function isBlockStartPoint(node, offset) {3577 return (!node.parentNode && offset == 0)3578 || (0 <= offset - 13579 && offset - 1 < node.childNodes.length3580 && isVisible(node.childNodes[offset - 1])3581 && (isBlockNode(node.childNodes[offset - 1])3582 || isHtmlElement(node.childNodes[offset - 1], "br")));3583}3584// "A boundary point (node, offset) is a block end point if either node's3585// parent is null and offset is node's length; or node has a child with index3586// offset, and that child is a visible block node."3587function isBlockEndPoint(node, offset) {3588 return (!node.parentNode && offset == getNodeLength(node))3589 || (offset < node.childNodes.length3590 && isVisible(node.childNodes[offset])3591 && isBlockNode(node.childNodes[offset]));3592}3593// "A boundary point is a block boundary point if it is either a block start3594// point or a block end point."3595function isBlockBoundaryPoint(node, offset) {3596 return isBlockStartPoint(node, offset)3597 || isBlockEndPoint(node, offset);3598}3599function blockExtend(range) {3600 // "Let start node, start offset, end node, and end offset be the start3601 // and end nodes and offsets of the range."3602 var startNode = range.startContainer;3603 var startOffset = range.startOffset;3604 var endNode = range.endContainer;3605 var endOffset = range.endOffset;3606 // "If some ancestor container of start node is an li, set start offset to3607 // the index of the last such li in tree order, and set start node to that3608 // li's parent."3609 var liAncestors = getAncestors(startNode).concat(startNode)3610 .filter(function(ancestor) { return isHtmlElement(ancestor, "li") })3611 .slice(-1);3612 if (liAncestors.length) {3613 startOffset = getNodeIndex(liAncestors[0]);3614 startNode = liAncestors[0].parentNode;3615 }3616 // "If (start node, start offset) is not a block start point, repeat the3617 // following steps:"3618 if (!isBlockStartPoint(startNode, startOffset)) do {3619 // "If start offset is zero, set it to start node's index, then set3620 // start node to its parent."3621 if (startOffset == 0) {3622 startOffset = getNodeIndex(startNode);3623 startNode = startNode.parentNode;3624 // "Otherwise, subtract one from start offset."3625 } else {3626 startOffset--;3627 }3628 // "If (start node, start offset) is a block boundary point, break from3629 // this loop."3630 } while (!isBlockBoundaryPoint(startNode, startOffset));3631 // "While start offset is zero and start node's parent is not null, set3632 // start offset to start node's index, then set start node to its parent."3633 while (startOffset == 03634 && startNode.parentNode) {3635 startOffset = getNodeIndex(startNode);3636 startNode = startNode.parentNode;3637 }3638 // "If some ancestor container of end node is an li, set end offset to one3639 // plus the index of the last such li in tree order, and set end node to3640 // that li's parent."3641 var liAncestors = getAncestors(endNode).concat(endNode)3642 .filter(function(ancestor) { return isHtmlElement(ancestor, "li") })3643 .slice(-1);3644 if (liAncestors.length) {3645 endOffset = 1 + getNodeIndex(liAncestors[0]);3646 endNode = liAncestors[0].parentNode;3647 }3648 // "If (end node, end offset) is not a block end point, repeat the3649 // following steps:"3650 if (!isBlockEndPoint(endNode, endOffset)) do {3651 // "If end offset is end node's length, set it to one plus end node's3652 // index, then set end node to its parent."3653 if (endOffset == getNodeLength(endNode)) {3654 endOffset = 1 + getNodeIndex(endNode);3655 endNode = endNode.parentNode;3656 // "Otherwise, add one to end offset.3657 } else {3658 endOffset++;3659 }3660 // "If (end node, end offset) is a block boundary point, break from3661 // this loop."3662 } while (!isBlockBoundaryPoint(endNode, endOffset));3663 // "While end offset is end node's length and end node's parent is not3664 // null, set end offset to one plus end node's index, then set end node to3665 // its parent."3666 while (endOffset == getNodeLength(endNode)3667 && endNode.parentNode) {3668 endOffset = 1 + getNodeIndex(endNode);3669 endNode = endNode.parentNode;3670 }3671 // "Let new range be a new range whose start and end nodes and offsets3672 // are start node, start offset, end node, and end offset."3673 var newRange = startNode.ownerDocument.createRange();3674 newRange.setStart(startNode, startOffset);3675 newRange.setEnd(endNode, endOffset);3676 // "Return new range."3677 return newRange;3678}3679function followsLineBreak(node) {3680 // "Let offset be zero."3681 var offset = 0;3682 // "While (node, offset) is not a block boundary point:"3683 while (!isBlockBoundaryPoint(node, offset)) {3684 // "If node has a visible child with index offset minus one, return3685 // false."3686 if (0 <= offset - 13687 && offset - 1 < node.childNodes.length3688 && isVisible(node.childNodes[offset - 1])) {3689 return false;3690 }3691 // "If offset is zero or node has no children, set offset to node's3692 // index, then set node to its parent."3693 if (offset == 03694 || !node.hasChildNodes()) {3695 offset = getNodeIndex(node);3696 node = node.parentNode;3697 // "Otherwise, set node to its child with index offset minus one, then3698 // set offset to node's length."3699 } else {3700 node = node.childNodes[offset - 1];3701 offset = getNodeLength(node);3702 }3703 }3704 // "Return true."3705 return true;3706}3707function precedesLineBreak(node) {3708 // "Let offset be node's length."3709 var offset = getNodeLength(node);3710 // "While (node, offset) is not a block boundary point:"3711 while (!isBlockBoundaryPoint(node, offset)) {3712 // "If node has a visible child with index offset, return false."3713 if (offset < node.childNodes.length3714 && isVisible(node.childNodes[offset])) {3715 return false;3716 }3717 // "If offset is node's length or node has no children, set offset to3718 // one plus node's index, then set node to its parent."3719 if (offset == getNodeLength(node)3720 || !node.hasChildNodes()) {3721 offset = 1 + getNodeIndex(node);3722 node = node.parentNode;3723 // "Otherwise, set node to its child with index offset and set offset3724 // to zero."3725 } else {3726 node = node.childNodes[offset];3727 offset = 0;3728 }3729 }3730 // "Return true."3731 return true;3732}3733//@}3734///// Recording and restoring overrides /////3735//@{3736function recordCurrentOverrides() {3737 // "Let overrides be a list of (string, string or boolean) ordered pairs,3738 // initially empty."3739 var overrides = [];3740 // "If there is a value override for "createLink", add ("createLink", value3741 // override for "createLink") to overrides."3742 if (getValueOverride("createlink") !== undefined) {3743 overrides.push(["createlink", getValueOverride("createlink")]);3744 }3745 // "For each command in the list "bold", "italic", "strikethrough",3746 // "subscript", "superscript", "underline", in order: if there is a state3747 // override for command, add (command, command's state override) to3748 // overrides."3749 ["bold", "italic", "strikethrough", "subscript", "superscript",3750 "underline"].forEach(function(command) {3751 if (getStateOverride(command) !== undefined) {3752 overrides.push([command, getStateOverride(command)]);3753 }3754 });3755 // "For each command in the list "fontName", "fontSize", "foreColor",3756 // "hiliteColor", in order: if there is a value override for command, add3757 // (command, command's value override) to overrides."3758 ["fontname", "fontsize", "forecolor",3759 "hilitecolor"].forEach(function(command) {3760 if (getValueOverride(command) !== undefined) {3761 overrides.push([command, getValueOverride(command)]);3762 }3763 });3764 // "Return overrides."3765 return overrides;3766}3767function recordCurrentStatesAndValues() {3768 // "Let overrides be a list of (string, string or boolean) ordered pairs,3769 // initially empty."3770 var overrides = [];3771 // "Let node be the first formattable node effectively contained in the3772 // active range, or null if there is none."3773 var node = getAllEffectivelyContainedNodes(getActiveRange())3774 .filter(isFormattableNode)[0];3775 // "If node is null, return overrides."3776 if (!node) {3777 return overrides;3778 }3779 // "Add ("createLink", node's effective command value for "createLink") to3780 // overrides."3781 overrides.push(["createlink", getEffectiveCommandValue(node, "createlink")]);3782 // "For each command in the list "bold", "italic", "strikethrough",3783 // "subscript", "superscript", "underline", in order: if node's effective3784 // command value for command is one of its inline command activated values,3785 // add (command, true) to overrides, and otherwise add (command, false) to3786 // overrides."3787 ["bold", "italic", "strikethrough", "subscript", "superscript",3788 "underline"].forEach(function(command) {3789 if (commands[command].inlineCommandActivatedValues3790 .indexOf(getEffectiveCommandValue(node, command)) != -1) {3791 overrides.push([command, true]);3792 } else {3793 overrides.push([command, false]);3794 }3795 });3796 // "For each command in the list "fontName", "foreColor", "hiliteColor", in3797 // order: add (command, command's value) to overrides."3798 ["fontname", "fontsize", "forecolor", "hilitecolor"].forEach(function(command) {3799 overrides.push([command, commands[command].value()]);3800 });3801 // "Add ("fontSize", node's effective command value for "fontSize") to3802 // overrides."3803 overrides.push(["fontsize", getEffectiveCommandValue(node, "fontsize")]);3804 // "Return overrides."3805 return overrides;3806}3807function restoreStatesAndValues(overrides) {3808 // "Let node be the first formattable node effectively contained in the3809 // active range, or null if there is none."3810 var node = getAllEffectivelyContainedNodes(getActiveRange())3811 .filter(isFormattableNode)[0];3812 // "If node is not null, then for each (command, override) pair in3813 // overrides, in order:"3814 if (node) {3815 for (var i = 0; i < overrides.length; i++) {3816 var command = overrides[i][0];3817 var override = overrides[i][1];3818 // "If override is a boolean, and queryCommandState(command)3819 // returns something different from override, call3820 // execCommand(command)."3821 if (typeof override == "boolean"3822 && myQueryCommandState(command) != override) {3823 myExecCommand(command);3824 // "Otherwise, if override is a string, and command is neither3825 // "createLink" nor "fontSize", and queryCommandValue(command)3826 // returns something not equivalent to override, call3827 // execCommand(command, false, override)."3828 } else if (typeof override == "string"3829 && command != "createlink"3830 && command != "fontsize"3831 && !areEquivalentValues(command, myQueryCommandValue(command), override)) {3832 myExecCommand(command, false, override);3833 // "Otherwise, if override is a string; and command is3834 // "createLink"; and either there is a value override for3835 // "createLink" that is not equal to override, or there is no value3836 // override for "createLink" and node's effective command value for3837 // "createLink" is not equal to override: call3838 // execCommand("createLink", false, override)."3839 } else if (typeof override == "string"3840 && command == "createlink"3841 && (3842 (3843 getValueOverride("createlink") !== undefined3844 && getValueOverride("createlink") !== override3845 ) || (3846 getValueOverride("createlink") === undefined3847 && getEffectiveCommandValue(node, "createlink") !== override3848 )3849 )) {3850 myExecCommand("createlink", false, override);3851 // "Otherwise, if override is a string; and command is "fontSize";3852 // and either there is a value override for "fontSize" that is not3853 // equal to override, or there is no value override for "fontSize"3854 // and node's effective command value for "fontSize" is not loosely3855 // equivalent to override:"3856 } else if (typeof override == "string"3857 && command == "fontsize"3858 && (3859 (3860 getValueOverride("fontsize") !== undefined3861 && getValueOverride("fontsize") !== override3862 ) || (3863 getValueOverride("fontsize") === undefined3864 && !areLooselyEquivalentValues(command, getEffectiveCommandValue(node, "fontsize"), override)3865 )3866 )) {3867 // "Convert override to an integer number of pixels, and set3868 // override to the legacy font size for the result."3869 override = getLegacyFontSize(override);3870 // "Call execCommand("fontSize", false, override)."3871 myExecCommand("fontsize", false, override);3872 // "Otherwise, continue this loop from the beginning."3873 } else {3874 continue;3875 }3876 // "Set node to the first formattable node effectively contained in3877 // the active range, if there is one."3878 node = getAllEffectivelyContainedNodes(getActiveRange())3879 .filter(isFormattableNode)[0]3880 || node;3881 }3882 // "Otherwise, for each (command, override) pair in overrides, in order:"3883 } else {3884 for (var i = 0; i < overrides.length; i++) {3885 var command = overrides[i][0];3886 var override = overrides[i][1];3887 // "If override is a boolean, set the state override for command to3888 // override."3889 if (typeof override == "boolean") {3890 setStateOverride(command, override);3891 }3892 // "If override is a string, set the value override for command to3893 // override."3894 if (typeof override == "string") {3895 setValueOverride(command, override);3896 }3897 }3898 }3899}3900//@}3901///// Deleting the selection /////3902//@{3903// The flags argument is a dictionary that can have blockMerging,3904// stripWrappers, and/or direction as keys.3905function deleteSelection(flags) {3906 if (flags === undefined) {3907 flags = {};3908 }3909 var blockMerging = "blockMerging" in flags ? Boolean(flags.blockMerging) : true;3910 var stripWrappers = "stripWrappers" in flags ? Boolean(flags.stripWrappers) : true;3911 var direction = "direction" in flags ? flags.direction : "forward";3912 // "If the active range is null, abort these steps and do nothing."3913 if (!getActiveRange()) {3914 return;3915 }3916 // "Canonicalize whitespace at the active range's start."3917 canonicalizeWhitespace(getActiveRange().startContainer, getActiveRange().startOffset);3918 // "Canonicalize whitespace at the active range's end."3919 canonicalizeWhitespace(getActiveRange().endContainer, getActiveRange().endOffset);3920 // "Let (start node, start offset) be the last equivalent point for the3921 // active range's start."3922 var start = getLastEquivalentPoint(getActiveRange().startContainer, getActiveRange().startOffset);3923 var startNode = start[0];3924 var startOffset = start[1];3925 // "Let (end node, end offset) be the first equivalent point for the active3926 // range's end."3927 var end = getFirstEquivalentPoint(getActiveRange().endContainer, getActiveRange().endOffset);3928 var endNode = end[0];3929 var endOffset = end[1];3930 // "If (end node, end offset) is not after (start node, start offset):"3931 if (getPosition(endNode, endOffset, startNode, startOffset) !== "after") {3932 // "If direction is "forward", call collapseToStart() on the context3933 // object's Selection."3934 //3935 // Here and in a few other places, we check rangeCount to work around a3936 // WebKit bug: it will sometimes incorrectly remove ranges from the3937 // selection if nodes are removed, so collapseToStart() will throw.3938 // This will break everything if we're using an actual selection, but3939 // if getActiveRange() is really just returning globalRange and that's3940 // all we care about, it will work fine. I only add the extra check3941 // for errors I actually hit in testing....

Full Screen

Full Screen

implementation.js

Source:implementation.js Github

copy

Full Screen

...3275 }3276 3277 return null;3278}3279function getFirstEquivalentPoint(node, offset) {3280 3281 3282 var prev;3283 while (prev = getPreviousEquivalentPoint(node, offset)) {3284 node = prev[0];3285 offset = prev[1];3286 }3287 3288 return [node, offset];3289}3290function getLastEquivalentPoint(node, offset) {3291 3292 3293 var next;3294 while (next = getNextEquivalentPoint(node, offset)) {3295 node = next[0];3296 offset = next[1];3297 }3298 3299 return [node, offset];3300}3301function isBlockStartPoint(node, offset) {3302 return (!node.parentNode && offset == 0)3303 || (0 <= offset - 13304 && offset - 1 < node.childNodes.length3305 && isVisible(node.childNodes[offset - 1])3306 && (isBlockNode(node.childNodes[offset - 1])3307 || isHtmlElement(node.childNodes[offset - 1], "br")));3308}3309function isBlockEndPoint(node, offset) {3310 return (!node.parentNode && offset == getNodeLength(node))3311 || (offset < node.childNodes.length3312 && isVisible(node.childNodes[offset])3313 && isBlockNode(node.childNodes[offset]));3314}3315function isBlockBoundaryPoint(node, offset) {3316 return isBlockStartPoint(node, offset)3317 || isBlockEndPoint(node, offset);3318}3319function blockExtend(range) {3320 3321 3322 var startNode = range.startContainer;3323 var startOffset = range.startOffset;3324 var endNode = range.endContainer;3325 var endOffset = range.endOffset;3326 3327 3328 3329 var liAncestors = getAncestors(startNode).concat(startNode)3330 .filter(function(ancestor) { return isHtmlElement(ancestor, "li") })3331 .slice(-1);3332 if (liAncestors.length) {3333 startOffset = getNodeIndex(liAncestors[0]);3334 startNode = liAncestors[0].parentNode;3335 }3336 3337 3338 if (!isBlockStartPoint(startNode, startOffset)) do {3339 3340 3341 if (startOffset == 0) {3342 startOffset = getNodeIndex(startNode);3343 startNode = startNode.parentNode;3344 3345 } else {3346 startOffset--;3347 }3348 3349 3350 } while (!isBlockBoundaryPoint(startNode, startOffset));3351 3352 3353 while (startOffset == 03354 && startNode.parentNode) {3355 startOffset = getNodeIndex(startNode);3356 startNode = startNode.parentNode;3357 }3358 3359 3360 3361 var liAncestors = getAncestors(endNode).concat(endNode)3362 .filter(function(ancestor) { return isHtmlElement(ancestor, "li") })3363 .slice(-1);3364 if (liAncestors.length) {3365 endOffset = 1 + getNodeIndex(liAncestors[0]);3366 endNode = liAncestors[0].parentNode;3367 }3368 3369 3370 if (!isBlockEndPoint(endNode, endOffset)) do {3371 3372 3373 if (endOffset == getNodeLength(endNode)) {3374 endOffset = 1 + getNodeIndex(endNode);3375 endNode = endNode.parentNode;3376 3377 } else {3378 endOffset++;3379 }3380 3381 3382 } while (!isBlockBoundaryPoint(endNode, endOffset));3383 3384 3385 3386 while (endOffset == getNodeLength(endNode)3387 && endNode.parentNode) {3388 endOffset = 1 + getNodeIndex(endNode);3389 endNode = endNode.parentNode;3390 }3391 3392 3393 var newRange = startNode.ownerDocument.createRange();3394 newRange.setStart(startNode, startOffset);3395 newRange.setEnd(endNode, endOffset);3396 3397 return newRange;3398}3399function followsLineBreak(node) {3400 3401 var offset = 0;3402 3403 while (!isBlockBoundaryPoint(node, offset)) {3404 3405 3406 if (0 <= offset - 13407 && offset - 1 < node.childNodes.length3408 && isVisible(node.childNodes[offset - 1])) {3409 return false;3410 }3411 3412 3413 if (offset == 03414 || !node.hasChildNodes()) {3415 offset = getNodeIndex(node);3416 node = node.parentNode;3417 3418 3419 } else {3420 node = node.childNodes[offset - 1];3421 offset = getNodeLength(node);3422 }3423 }3424 3425 return true;3426}3427function precedesLineBreak(node) {3428 3429 var offset = getNodeLength(node);3430 3431 while (!isBlockBoundaryPoint(node, offset)) {3432 3433 if (offset < node.childNodes.length3434 && isVisible(node.childNodes[offset])) {3435 return false;3436 }3437 3438 3439 if (offset == getNodeLength(node)3440 || !node.hasChildNodes()) {3441 offset = 1 + getNodeIndex(node);3442 node = node.parentNode;3443 3444 3445 } else {3446 node = node.childNodes[offset];3447 offset = 0;3448 }3449 }3450 3451 return true;3452}3453function recordCurrentOverrides() {3454 3455 3456 var overrides = [];3457 3458 3459 if (getValueOverride("createlink") !== undefined) {3460 overrides.push(["createlink", getValueOverride("createlink")]);3461 }3462 3463 3464 3465 3466 ["bold", "italic", "strikethrough", "subscript", "superscript",3467 "underline"].forEach(function(command) {3468 if (getStateOverride(command) !== undefined) {3469 overrides.push([command, getStateOverride(command)]);3470 }3471 });3472 3473 3474 3475 ["fontname", "fontsize", "forecolor",3476 "hilitecolor"].forEach(function(command) {3477 if (getValueOverride(command) !== undefined) {3478 overrides.push([command, getValueOverride(command)]);3479 }3480 });3481 3482 return overrides;3483}3484function recordCurrentStatesAndValues() {3485 3486 3487 var overrides = [];3488 3489 3490 var node = getAllEffectivelyContainedNodes(getActiveRange())3491 .filter(isFormattableNode)[0];3492 3493 if (!node) {3494 return overrides;3495 }3496 3497 3498 overrides.push(["createlink", getEffectiveCommandValue(node, "createlink")]);3499 3500 3501 3502 3503 3504 ["bold", "italic", "strikethrough", "subscript", "superscript",3505 "underline"].forEach(function(command) {3506 if (commands[command].inlineCommandActivatedValues3507 .indexOf(getEffectiveCommandValue(node, command)) != -1) {3508 overrides.push([command, true]);3509 } else {3510 overrides.push([command, false]);3511 }3512 });3513 3514 3515 ["fontname", "fontsize", "forecolor", "hilitecolor"].forEach(function(command) {3516 overrides.push([command, commands[command].value()]);3517 });3518 3519 3520 overrides.push(["fontsize", getEffectiveCommandValue(node, "fontsize")]);3521 3522 return overrides;3523}3524function restoreStatesAndValues(overrides) {3525 3526 3527 var node = getAllEffectivelyContainedNodes(getActiveRange())3528 .filter(isFormattableNode)[0];3529 3530 3531 if (node) {3532 for (var i = 0; i < overrides.length; i++) {3533 var command = overrides[i][0];3534 var override = overrides[i][1];3535 3536 3537 3538 if (typeof override == "boolean"3539 && myQueryCommandState(command) != override) {3540 commands[command].action("");3541 3542 3543 3544 3545 } else if (typeof override == "string"3546 && command != "createlink"3547 && command != "fontsize"3548 && !areEquivalentValues(command, myQueryCommandValue(command), override)) {3549 commands[command].action(override);3550 3551 3552 3553 3554 3555 3556 } else if (typeof override == "string"3557 && command == "createlink"3558 && (3559 (3560 getValueOverride("createlink") !== undefined3561 && getValueOverride("createlink") !== override3562 ) || (3563 getValueOverride("createlink") === undefined3564 && getEffectiveCommandValue(node, "createlink") !== override3565 )3566 )) {3567 commands.createlink.action(override);3568 3569 3570 3571 3572 3573 } else if (typeof override == "string"3574 && command == "fontsize"3575 && (3576 (3577 getValueOverride("fontsize") !== undefined3578 && getValueOverride("fontsize") !== override3579 ) || (3580 getValueOverride("fontsize") === undefined3581 && !areLooselyEquivalentValues(command, getEffectiveCommandValue(node, "fontsize"), override)3582 )3583 )) {3584 3585 3586 override = getLegacyFontSize(override);3587 3588 3589 commands.fontsize.action(override);3590 3591 } else {3592 continue;3593 }3594 3595 3596 node = getAllEffectivelyContainedNodes(getActiveRange())3597 .filter(isFormattableNode)[0]3598 || node;3599 }3600 3601 } else {3602 for (var i = 0; i < overrides.length; i++) {3603 var command = overrides[i][0];3604 var override = overrides[i][1];3605 3606 3607 if (typeof override == "boolean") {3608 setStateOverride(command, override);3609 }3610 3611 3612 if (typeof override == "string") {3613 setValueOverride(command, override);3614 }3615 }3616 }3617}3618function deleteSelection(flags) {3619 if (flags === undefined) {3620 flags = {};3621 }3622 var blockMerging = "blockMerging" in flags ? Boolean(flags.blockMerging) : true;3623 var stripWrappers = "stripWrappers" in flags ? Boolean(flags.stripWrappers) : true;3624 var direction = "direction" in flags ? flags.direction : "forward";3625 3626 if (!getActiveRange()) {3627 return;3628 }3629 3630 canonicalizeWhitespace(getActiveRange().startContainer, getActiveRange().startOffset);3631 3632 canonicalizeWhitespace(getActiveRange().endContainer, getActiveRange().endOffset);3633 3634 3635 var start = getLastEquivalentPoint(getActiveRange().startContainer, getActiveRange().startOffset);3636 var startNode = start[0];3637 var startOffset = start[1];3638 3639 3640 var end = getFirstEquivalentPoint(getActiveRange().endContainer, getActiveRange().endOffset);3641 var endNode = end[0];3642 var endOffset = end[1];3643 3644 if (getPosition(endNode, endOffset, startNode, startOffset) !== "after") {3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var point = new wpt.Point(1, 2);3var point2 = new wpt.Point(1, 2);4var point3 = new wpt.Point(2, 2);5var point4 = new wpt.Point(3, 2);6var point5 = new wpt.Point(4, 2);7var point6 = new wpt.Point(5, 2);8var point7 = new wpt.Point(6, 2);9var point8 = new wpt.Point(7, 2);10var point9 = new wpt.Point(8, 2);11var point10 = new wpt.Point(9, 2);12var point11 = new wpt.Point(10, 2);13var point12 = new wpt.Point(11, 2);14var point13 = new wpt.Point(12, 2);15var point14 = new wpt.Point(13, 2);16var point15 = new wpt.Point(14, 2);17var point16 = new wpt.Point(15, 2);18var point17 = new wpt.Point(16, 2);19var point18 = new wpt.Point(17, 2);20var point19 = new wpt.Point(18, 2);21var point20 = new wpt.Point(19, 2);22var point21 = new wpt.Point(20, 2);23var point22 = new wpt.Point(21, 2);24var point23 = new wpt.Point(22, 2);25var point24 = new wpt.Point(23, 2);26var point25 = new wpt.Point(24, 2);27var point26 = new wpt.Point(25, 2);28var point27 = new wpt.Point(26, 2);29var point28 = new wpt.Point(27, 2);30var point29 = new wpt.Point(28, 2);31var point30 = new wpt.Point(29, 2);32var point31 = new wpt.Point(30, 2);33var point32 = new wpt.Point(31, 2);34var point33 = new wpt.Point(32, 2);35var point34 = new wpt.Point(33, 2);36var point35 = new wpt.Point(34, 2

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var options = {3};4var page = wptools.page('Wikipedia', options);5page.getFirstEquivalentPoint(function(err, resp) {6 if (err) {7 console.log(err);8 }9 console.log(resp);10});11var wptools = require('wptools');12var options = {13};14var page = wptools.page('Wikipedia', options);15page.getFirstEquivalentPoint(function(err, resp) {16 if (err) {17 console.log(err);18 }19 console.log(resp);20});21var wptools = require('wptools');22var options = {23};24var page = wptools.page('Wikipedia', options);25page.getFirstEquivalentPoint(function(err, resp) {26 if (err) {27 console.log(err);28 }29 console.log(resp);30});31var wptools = require('wptools');32var options = {33};34var page = wptools.page('Wikipedia', options);35page.getFirstEquivalentPoint(function(err, resp) {36 if (err) {37 console.log(err);38 }39 console.log(resp);40});41var wptools = require('wptools');42var options = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.getFirstEquivalentPoint( 'en', 'New York City', function(err, result) {3 if (err) {4 console.log(err);5 } else {6 console.log(result);7 }8});9var wptools = require('wptools');10wptools.getFirstEquivalentPoint( 'en', 'New York City', function(err, result) {11 if (err) {12 console.log(err);13 } else {14 console.log(result);15 }16});17var wptools = require('wptools');18wptools.getFirstEquivalentPoint( 'en', 'New York City', function(err, result) {19 if (err) {20 console.log(err);21 } else {22 console.log(result);23 }24});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var point = wpt.getFirstEquivalentPoint(100, 100, 200, 200, 100, 100);3console.log(point);4{ x: 100, y: 100 }5getFirstEquivalentPoint(x1, y1, x2, y2, x, y) Parameters6getFirstEquivalentPoint(x1, y1, x2, y2, x, y) Return Value

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wptClient = new wpt('your api key');3 if (err) {4 console.log(err);5 } else {6 console.log(res);7 }8});9var wpt = require('wpt');10var wptClient = new wpt('your api key');11 if (err) {12 console.log(err);13 } else {14 console.log(res);15 }16});17var wpt = require('wpt');18var wptClient = new wpt('your api key');19 if (err) {20 console.log(err);21 } else {22 console.log(res);23 }24});25var wpt = require('wpt');26var wptClient = new wpt('your api key');

Full Screen

Using AI Code Generation

copy

Full Screen

1var firstEquivalentPoint = wpt.getFirstEquivalentPoint(points, 0.0001);2console.log(firstEquivalentPoint);3fs.appendFileSync('output.txt', firstEquivalentPoint);4var firstEquivalentPoint = wpt.getFirstEquivalentPoint(points, 0.0001);5console.log(firstEquivalentPoint);6fs.appendFileSync('output.txt', firstEquivalentPoint);7var firstEquivalentPoint = wpt.getFirstEquivalentPoint(points, 0.0001);8console.log(firstEquivalentPoint);9fs.appendFileSync('output.txt', firstEquivalentPoint);10var firstEquivalentPoint = wpt.getFirstEquivalentPoint(points, 0.0001);11console.log(firstEquivalentPoint);12fs.appendFileSync('output.txt', firstEquivalentPoint);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2var wpt_key = 'your key';3 console.log(results);4});5var request = require('request');6var wpt = {};7wpt.getFirstEquivalentPoint = function(key, url, callback) {8 request(wpt_url, function(error, response, body) {9 if (!error && response.statusCode == 200) {10 var results = JSON.parse(body);11 var testID = results.data.testId;12 request(wpt_results_url, function(error, response, body) {13 if (!error && response.statusCode == 200) {14 var results = JSON.parse(body);15 var fv = results.data.average.firstView;16 var result = {17 };18 callback(result);19 }20 });21 }22 });23};24module.exports = wpt;

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var path = require('path');3 {x: 0, y: 0},4 {x: 0, y: 1},5 {x: 0, y: 2},6 {x: 0, y: 3},7 {x: 0, y: 4},8 {x: 0, y: 5},9 {x: 0, y: 6},10 {x: 0, y: 7},11 {x: 0, y: 8},12 {x: 0, y: 9},13 {x: 0, y: 10},14 {x: 0, y: 11},15 {x: 0, y: 12},16 {x: 0, y: 13},17 {x: 0, y: 14},18 {x: 0, y: 15},19 {x: 0, y: 16},20 {x: 0, y: 17},21 {x: 0, y: 18},22 {x: 0, y: 19},23 {x: 0, y: 20},24 {x: 0, y: 21},25 {x: 0, y: 22},26 {x: 0, y: 23},27 {x: 0, y: 24},28 {x: 0, y: 25},29 {x: 0, y: 26},30 {x: 0, y: 27},31 {x: 0, y: 28},32 {x: 0, y: 29},33 {x: 0, y: 30},34 {x: 0, y: 31},35 {x: 0, y: 32},36 {x: 0, y: 33},37 {x: 0, y: 34},38 {x: 0

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful