Skip to content

Commit a67d387

Browse files
committed
Add and remove prefixes for flex and align properties
1 parent 902748a commit a67d387

File tree

8 files changed

+1395
-135
lines changed

8 files changed

+1395
-135
lines changed

build-prefixes.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ const BROWSER_MAPPING = {
1515
op_mini: null,
1616
};
1717

18+
let flexSpec = {};
1819
let p = new Map();
1920
for (let prop in prefixes) {
2021
let browserMap = {};
2122
for (let b of prefixes[prop].browsers) {
22-
let [name, version] = b.split(' ');
23+
let [name, version, flex_spec] = b.split(' ');
2324
if (BROWSER_MAPPING[name] === null) {
2425
continue;
2526
}
@@ -42,6 +43,21 @@ for (let prop in prefixes) {
4243
browserMap[name][prefix][1] = v;
4344
}
4445
}
46+
47+
if (flex_spec === '2009') {
48+
// console.log(prop, name, version, flex_spec);
49+
if (flexSpec[name] == null) {
50+
flexSpec[name] = [v, v];
51+
} else {
52+
if (v < flexSpec[name][0]) {
53+
flexSpec[name][0] = v;
54+
}
55+
56+
if (v > flexSpec[name][1]) {
57+
flexSpec[name][1] = v;
58+
}
59+
}
60+
}
4561
}
4662
// p[prop] = browserMap;
4763
let s = JSON.stringify(browserMap);
@@ -58,7 +74,6 @@ for (let prop in prefixes) {
5874
}
5975
}
6076

61-
console.log(p)
6277

6378
let prefixMapping = {
6479
webkit: 'WebKit',
@@ -107,6 +122,17 @@ impl Feature {
107122
prefixes
108123
}
109124
}
125+
126+
pub fn is_flex_2009(browsers: Browsers) -> bool {
127+
${Object.entries(flexSpec).map(([name, [min, max]]) => {
128+
return `if let Some(version) = browsers.${name} {
129+
if version >= ${min} && version <= ${max} {
130+
return true;
131+
}
132+
}`;
133+
}).join('\n ')}
134+
false
135+
}
110136
`;
111137

112138
fs.writeFileSync('src/properties/prefixes.rs', s);

src/declaration.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ impl DeclarationHandler {
6161
pub fn new(important: bool, targets: Option<Browsers>) -> Self {
6262
DeclarationHandler {
6363
important,
64+
flex: FlexHandler::new(targets),
65+
align: AlignHandler::new(targets),
6466
transition: TransitionHandler::new(targets),
6567
prefix: PrefixHandler::new(targets),
6668
..DeclarationHandler::default()

0 commit comments

Comments
 (0)