Sha256: 499cfef3abf2238ce15c09ddde6fb9ed147aa159ef1bee5e94f1f79947e0e9ef

Contents?: true

Size: 1.42 KB

Versions: 26

Compression:

Stored size: 1.42 KB

Contents

'use strict';

require('../../utils/click/isClickableInput.js');
require('../../utils/dataTransfer/Clipboard.js');
var isContentEditable = require('../../utils/edit/isContentEditable.js');
require('../../utils/edit/isEditable.js');
require('../../utils/edit/maxLength.js');
var selection = require('../../utils/focus/selection.js');
require('../../utils/keyDef/readNextDescriptor.js');
require('../../utils/misc/level.js');
require('../../options.js');
var setSelection = require('./setSelection.js');

/**
 * Backward-compatible selection.
 *
 * Handles input elements and contenteditable if it only contains a single text node.
 */ function setSelectionRange(element, anchorOffset, focusOffset) {
    var _element_firstChild;
    if (selection.hasOwnSelection(element)) {
        return setSelection.setSelection({
            focusNode: element,
            anchorOffset,
            focusOffset
        });
    }
    /* istanbul ignore else */ if (isContentEditable.isContentEditable(element) && ((_element_firstChild = element.firstChild) === null || _element_firstChild === void 0 ? void 0 : _element_firstChild.nodeType) === 3) {
        return setSelection.setSelection({
            focusNode: element.firstChild,
            anchorOffset,
            focusOffset
        });
    }
    /* istanbul ignore next */ throw new Error('Not implemented. The result of this interaction is unreliable.');
}

exports.setSelectionRange = setSelectionRange;

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/event/selection/setSelectionRange.js