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

Open
canavese opened this Issue Sep 14, 2009 · 2 comments

Comments

Projects
None yet
2 participants

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' );
}

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' );
}
Member

Synchro commented Jun 12, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment