10 lines
324 B
JavaScript
10 lines
324 B
JavaScript
/**
|
|
* Detects the text direction in the element.
|
|
* @returns {Direction} The text direction ('ltr' for left-to-right or 'rtl' for right-to-left).
|
|
*/
|
|
export function getElemDirection(elem) {
|
|
const style = window.getComputedStyle(elem);
|
|
const direction = style.getPropertyValue("direction");
|
|
return direction;
|
|
}
|