Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60041fe

Browse filesBrowse files
committed
style
1 parent 2d9fa49 commit 60041fe
Copy full SHA for 60041fe

File tree

Expand file treeCollapse file tree

1 file changed

+21
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+21
-14
lines changed

‎src/directives/internal/style.js

Copy file name to clipboardExpand all lines: src/directives/internal/style.js
+21-14Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1-
var _ = require('../../util')
2-
var prefixes = ['-webkit-', '-moz-', '-ms-']
3-
var camelPrefixes = ['Webkit', 'Moz', 'ms']
4-
var importantRE = /!important;?$/
5-
var testEl = null
6-
var propCache = {}
1+
import {
2+
extend,
3+
isArray,
4+
hyphenate,
5+
camelize
6+
} from '../../util'
77

8-
module.exports = {
8+
const prefixes = ['-webkit-', '-moz-', '-ms-']
9+
const camelPrefixes = ['Webkit', 'Moz', 'ms']
10+
const importantRE = /!important;?$/
11+
const propCache = Object.create(null)
12+
13+
let testEl = null
14+
15+
export default {
916

1017
deep: true,
1118

12-
update: function (value) {
19+
update (value) {
1320
if (typeof value === 'string') {
1421
this.el.style.cssText = value
15-
} else if (_.isArray(value)) {
16-
this.handleObject(value.reduce(_.extend, {}))
22+
} else if (isArray(value)) {
23+
this.handleObject(value.reduce(extend, {}))
1724
} else {
1825
this.handleObject(value || {})
1926
}
2027
},
2128

22-
handleObject: function (value) {
29+
handleObject (value) {
2330
// cache object styles so that only changed props
2431
// are actually updated.
2532
var cache = this.cache || (this.cache = {})
@@ -39,7 +46,7 @@ module.exports = {
3946
}
4047
},
4148

42-
handleSingle: function (prop, value) {
49+
handleSingle (prop, value) {
4350
prop = normalize(prop)
4451
if (!prop) return // unsupported prop
4552
// cast possible numbers/booleans into strings
@@ -87,8 +94,8 @@ function normalize (prop) {
8794
*/
8895

8996
function prefix (prop) {
90-
prop = _.hyphenate(prop)
91-
var camel = _.camelize(prop)
97+
prop = hyphenate(prop)
98+
var camel = camelize(prop)
9299
var upper = camel.charAt(0).toUpperCase() + camel.slice(1)
93100
if (!testEl) {
94101
testEl = document.createElement('div')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.