Skip to content

Commit 45f8566

Browse files
author
rofrischmann
committed
fixed prefix sorting
1 parent 566dbcf commit 45f8566

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

modules/static/prefixAll.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import prefixProperties from './prefixProps'
22
import capitalizeString from '../utils/capitalizeString'
3+
import sortPrefixedStyle from '../utils/sortPrefixedStyle'
34

45
import position from './plugins/position'
56
import calc from './plugins/calc'

modules/utils/sortPrefixedStyle.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
export function sortPrefixedStyle(style) {
1+
import isPrefixedProperty from './isPrefixedProperty'
2+
3+
export default function sortPrefixedStyle(style) {
24
return Object.keys(style).sort((left, right) => {
3-
if (isPrefixed(left) && !isPrefixed(right)) {
5+
if (isPrefixedProperty(left) && !isPrefixedProperty(right)) {
46
return -1
5-
} else if (!isPrefixed(left) && isPrefixed(right)) {
7+
} else if (!isPrefixedProperty(left) && isPrefixedProperty(right)) {
68
return 1
79
}
810
return 0

test/prefixer-test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const Chrome49 = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
1515
const SeaMonkey = 'Mozilla/5.0 (Windows NT 5.2; RW; rv:7.0a1) Gecko/20091211 SeaMonkey/9.23a1pre'
1616
const Chromium = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/50.0.2661.102 Chrome/50.0.2661.102 Safari/537.36'
1717
const PhantomJS = 'Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.0.0 Safari/538.1'
18+
const Samsung = 'Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G900F Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36'
19+
20+
console.log(new Prefixer({ userAgent: Samsung })._browserInfo)
1821

1922
describe('Prefixing a property', () => {
2023
it('should only add required prefixes', () => {

0 commit comments

Comments
 (0)