feat: added direction css property

This commit is contained in:
Hasan Parasteh
2021-05-11 10:30:36 +04:30
parent 2a013e20c8
commit 59afa352dd
2 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
export const enum DIRECTION {
RTL = 0,
LTR = 1,
INHERIT = 2
}
export const direction: IPropertyIdentValueDescriptor<DIRECTION> = {
name: 'direction',
initialValue: 'inherit',
prefix: false,
type: PropertyDescriptorParsingType.IDENT_VALUE,
parse: (direction: string) => {
switch (direction) {
case 'rtl':
return DIRECTION.RTL;
case 'ltr':
return DIRECTION.LTR;
case 'inherit':
return DIRECTION.INHERIT;
}
return DIRECTION.INHERIT;
}
};

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html dir="rtl" lang="fa-IR">
<head>
<title>direction</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../test.js"></script>
<style>
body{
font-family: Arial;
}
.test{
padding: 10px 25px;
direction: rtl;
}
</style>
</head>
<body>
<div class="test" lang="fa">
<p>
سلام دنیا! این یک تست است...
</p>
</div>
<span class="test" lang="fa">من می‌توانم. این است قدرت جاوااسکریپت!</span>
</body>
</html>