7

does PhantomJS support modern flex? if I run this file:

$ cat x.js
var $ = require('jquery');
$('<div/>', {id: 'x'}).appendTo($('body'));
var x = $('#x');
x.css('color', 'red');
console.log('color: ' + x.css('color'));
x.css('flex', '0 0 0px');
console.log('css: ' + x.css('flex'));

one can see that .css() works fine for colour but not for flex.

$ phantomjs x.js
color: rgb(255, 0, 0)
css: undefined

I've also tried some of the variants: -webkit-flex, -moz-box-flex and -ms-flex, all of which yield the same results. curiously, -webkit-box-flex returns 0 instead of undefined, but that seems wrong.

I'm running with:

$ phantomjs --version
1.9.8
Paulie_D
  • 107,962
  • 13
  • 142
  • 161
ekkis
  • 9,804
  • 13
  • 55
  • 105

1 Answers1

3

Considering that the PhantomJS 1.x engine is now more than 5 years old. Yes, flexbox is not supported. Modernizr reports that flexboxlegacy is supported. With PhantomJS 2.x you get support for flex.

Community
  • 1
  • 1
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
  • well... it took some doing to get v2 installed on OSX. the npm version didn't work but fortunately the home-brew version works (I'm now on 2.1.1) and yes! it supports flex. yea!! – ekkis Feb 19 '16 at 22:01
  • 4
    I'd say **limited** flex support. Turns out centering doesn't work properly: https://github.com/ariya/phantomjs/issues/12367 – ılǝ May 11 '16 at 12:57
  • Using the early spec syntax works on 2.1.1, for issues such as centering. http://www.html5rocks.com/en/tutorials/flexbox/quick/ – Navid Khan May 28 '20 at 10:25