mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
feat: added direction css property
This commit is contained in:
25
src/css/property-descriptors/direction.ts
Normal file
25
src/css/property-descriptors/direction.ts
Normal 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;
|
||||
}
|
||||
};
|
||||
26
tests/reftests/direction.html
Normal file
26
tests/reftests/direction.html
Normal 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>
|
||||
Reference in New Issue
Block a user