数通智联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
869 B

"use strict";
/**
* Get the declared text direction for an element.
*
* @param {Node} element
* @returns {string|undefined}
*/
function getTextDirection(element) {
var _element;
// There is another way to determine text direction using getComputedStyle(), as done here:
// https://github.com/pencil-js/text-direction/blob/2a235ce95089b3185acec3b51313cbba921b3811/text-direction.js
//
// We do not use that approach because we are interested specifically in the _declared_ text direction.
// If no text direction is declared, we have to provide our own explicit text direction so our
// bidirectional CSS style sheets work.
while (element && !element.dir) {
// eslint-disable-next-line no-param-reassign
element = element.parentNode;
}
return (_element = element) == null ? void 0 : _element.dir;
}
module.exports = getTextDirection;