less.ruby icon indicating copy to clipboard operation
less.ruby copied to clipboard

Less chokes on some IE expressions (in Lightview's CSS)

Open canavese opened this issue 16 years ago • 2 comments

I'm using Nick Stakenburg's popular Lightview JS/CSS library (http://www.nickstakenburg.com/projects/lightview/) and can't include it using LESS. It chokes on a number of IE expressions:

  • html body #lightviewController { /* IE6 */ position: absolute; top: auto; margin-top: expression( (-1 * this.offsetHeight / 2 + (document.documentElement ? document.documentElement.scrollTop : 0) + (Lightview.controllerOffset || 0)) + 'px'); }
  • html #lightview { /* IE6 */ position: absolute; margin-top: expression( (-1 * this.offsetHeight / 2 + (document.documentElement ? document.documentElement.scrollTop : 0) - (Lightview.controllerHeight || 0)) + 'px'); margin-left: expression( -1 * this.offsetWidth / 2 + (document.documentElement ? document.documentElement.scrollLeft : 0) + 'px'); }

/* Always cover 100% of the screen in IE6 */ html #lv_overlay { position: absolute; height: expression(((window.Enumerable && window.Enumerable.max) ? [document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight].max() : document.documentElement.scrollHeight) + 'px' ); width: expression(((window.Enumerable && window.Enumerable.max) ? [document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.clientHeight].max() : document.documentElement.scrollWidth) + 'px' ); }

canavese avatar Sep 14 '09 04:09 canavese

Sorry for the poor formatting. Trying again:

* html body #lightviewController { /* IE6 */
    position: absolute;
    top: auto;
    margin-top: expression( (-1 * this.offsetHeight / 2 + (document.documentElement ? document.documentElement.scrollTop : 0) + (Lightview.controllerOffset || 0)) + 'px'); 
}

* html #lightview { /* IE6 */
    position: absolute;
    margin-top: expression( (-1 * this.offsetHeight / 2 + (document.documentElement ? document.documentElement.scrollTop : 0) - (Lightview.controllerHeight || 0)) + 'px');
    margin-left: expression( -1 * this.offsetWidth / 2 + (document.documentElement ? document.documentElement.scrollLeft : 0) + 'px');
}

/* Always cover 100% of the screen in IE6 */
html #lv_overlay {
    position: absolute;
    height: expression(((window.Enumerable && window.Enumerable.max) ? [document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight].max() : document.documentElement.scrollHeight) + 'px' );
    width: expression(((window.Enumerable && window.Enumerable.max) ? [document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.clientHeight].max() : document.documentElement.scrollWidth) + 'px' );
}

canavese avatar Sep 14 '09 04:09 canavese

You need to escape invalid/odd CSS markup in LESS using ~. More complex example here.

Synchro avatar Jun 12 '12 12:06 Synchro