Giter Site home page Giter Site logo

Comments (10)

threepointone avatar threepointone commented on June 11, 2024 2

the next version of glamor should do this automatically

from glamor.

jaydenseric avatar jaydenseric commented on June 11, 2024 1

Placeholder is still not vendor prefixing:

import React from 'react'
import {css} from 'glamor'

const styles = {
  '::placeholder': {
    color: 'red'
  }
}

export default () => (
  <input className={css(styles)} placeholder='Test' />
)

Results in this output in the head stylesheet:

.css-f6kjmy::placeholder,[data-css-f6kjmy]::placeholder,.css-f6kjmy[data-simulate-placeholder],[data-css-f6kjmy][data-simulate-placeholder]{color:red;}

from glamor.

fhelwanger avatar fhelwanger commented on June 11, 2024 1

I think I figured out how to resolve it. Working on a PR.

from glamor.

threepointone avatar threepointone commented on June 11, 2024

Good catch, I didn't know this. I should be able to add it. As a workaround for now, try this undocumented method - add(':-webkit-input-placeholder', style) (note the single colon, not double)

from glamor.

eldh avatar eldh commented on June 11, 2024

Cool! I ended up with this:

const placeholder = (x) => ({
  ...add(':placeholder', x),
  ...add(':-webkit-input-placeholder', x),
  ...add(':-moz-placeholder', x),
  ...add(':-ms-input-placeholder', x),
})

from glamor.

threepointone avatar threepointone commented on June 11, 2024

✌️

from glamor.

threepointone avatar threepointone commented on June 11, 2024

ah, it doesn't do it for the nested version, only when using the helper. will fix.

from glamor.

threepointone avatar threepointone commented on June 11, 2024

fixed in 2.20.14

from glamor.

fhelwanger avatar fhelwanger commented on June 11, 2024

It isn't working right now.

Glamor put all vendor prefixes in a single comma separated rule:

glamor/src/index.js

Lines 322 to 325 in 09dd49d

let _key =
key === '::placeholder' ?
'::placeholder,::-webkit-input-placeholder,::-moz-placeholder,::-ms-input-placeholder'
: key

But it doesn't work. I found why here: http://stackoverflow.com/a/23338422/2379685

...if any selector in your comma separated list is not recognized by your browser, it skips the whole rule and goes on to the next.

You can test it in this fiddle using chrome:

https://jsfiddle.net/Lcjfkrb2/

Also, you can go to https://autoprefixer.github.io/ and paste:

input::placeholder {
  color: red
}

The result will be:

input::-webkit-input-placeholder {
  color: red
}
input::-moz-placeholder {
  color: red
}
input:-ms-input-placeholder {
  color: red
}
input::placeholder {
  color: red
}

Couldn't this be handled by autoprefixer instead of hard coded?

from glamor.

fhelwanger avatar fhelwanger commented on June 11, 2024

Done!

from glamor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.