gecko-dev/dom/public/idl/range/Range.idl

74 строки
2.2 KiB
Plaintext

interface Range {
/* IID: { 0xa6cf90ce, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
const unsigned short START_TO_START = 0;
const unsigned short START_TO_END = 1;
const unsigned short END_TO_START = 2;
const unsigned short END_TO_END = 3;
readonly attribute Node startContainer;
readonly attribute long startOffset;
readonly attribute Node endContainer;
readonly attribute long endOffset;
readonly attribute boolean collapsed;
readonly attribute Node commonAncestorContainer;
void setStart(in Node parent, in long offset);
void setStartBefore(in Node sibling);
void setStartAfter(in Node sibling);
void setEnd(in Node parent, in long offset);
void setEndBefore(in Node sibling);
void setEndAfter(in Node sibling);
void collapse(in boolean toStart);
void selectNode(in Node n);
void selectNodeContents(in Node n);
int compareBoundaryPoints(in unsigned short how, in Range srcRange);
void deleteContents();
DocumentFragment extractContents();
DocumentFragment cloneContents();
void insertNode(in Node n);
void surroundContents(in Node n);
Range cloneRange();
void detach();
DOMString toString();
};
interface NSRange {
/* IID: { 0xa6cf90f2, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
DocumentFragment createContextualFragment(in DOMString fragment);
boolean isValidFragment(in DOMString fragment);
// Is the point contained in the range?
boolean isPointInRange(in Node parent, in long offset);
// comparePoint returns
// -1 if point is before range,
// 0 if point is in range,
// 1 if point is after range
// Sort of a strcmp for ranges.
short comparePoint(in Node parent, in long offset);
// Does the node intersect the range?
boolean intersectsNode(in Node n);
// HOW does the node intersect the range? Four possible values:
const unsigned short NODE_BEFORE = 0;
const unsigned short NODE_AFTER = 1;
const unsigned short NODE_BEFORE_AND_AFTER = 2;
const unsigned short NODE_INSIDE = 3;
unsigned short compareNode(in Node n);
void nSDetach();
};