-1

My editor raises an error with the colon after the word height below - what's wrong with the colon being there and how to correct?

* html #TB_overlay { /* ie6 hack */
     position: absolute;
     height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
}

I have a similar error with the minus sign below highlighted as unexpected token:

margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');

Finally, the Const operator below is errored in a js script:

const CKEDITOR_BTN_REMOVED = 'SpecialChar,Subscript,Superscript,PasteFromWord,Smiley,BGColor,TextColor,HorizontalRule,PageBreak,Table,Font,RemoveFormat,Blockquote';
Del
  • 131
  • 2
  • 13
  • 1
    Maybe it just doesn't like or really know about the really outdated css `expression`. – takendarkk Mar 24 '17 at 00:10
  • 1
    So they are valid css expressions but the editor is the problem? – Del Mar 24 '17 at 00:13
  • I've never seen people use javascript inside of css before... But google says that it is indeed valid for old browsers. I suspect that it has very little support though. – Shadow Mar 24 '17 at 00:13
  • I don't know, but It is possible. It seems it was introduced with IE5 and removed starting with IE8. – takendarkk Mar 24 '17 at 00:13
  • Are you using a specific CSS preprocessor to make this remotely possible? Is this some JavaScript-CSS hybrid? – Dave Newton Mar 24 '17 at 00:13
  • What language are you writing in? – Ibu Mar 24 '17 at 00:14
  • The unrelated JS question-how are you transpiling and/or what environment are you trying to run this in? – Dave Newton Mar 24 '17 at 00:15
  • Transpiling? Are you kidding? – Ringo Mar 24 '17 at 00:16
  • The first two are css files being included - written by third parties - but erroring in netbeans. The js is a separate file being included within php scripts. – Del Mar 24 '17 at 00:17
  • 1
    @Ringo ES6 isn't supported everywhere, including the OP's current editor it seems, so no, I'm not. Are you? – Dave Newton Mar 24 '17 at 00:17
  • 1
    This was code that was popular 10 years ago, literally. It's not ES6. – Ringo Mar 24 '17 at 00:19
  • @Ringo The code the OP stated is in a separate JS file is completely valid ES6 and would show errors in an ES5 environment that didn't support const. I think I made it clear that I was addressing the JS question with my second comment, and have no idea what the first snippet is supposed to be as per my first comment. – Dave Newton Mar 24 '17 at 00:20
  • oh, my bad. he is using a CONST. oopsie! – Ringo Mar 24 '17 at 00:28
  • @Del Look, if you're getting errors on *const*, you're probably going to hit a lot of other errors, too. (For example, keyword *let* would throw a similar error.) If it's just a third-party library, i'd try to find a version of it that is EcmaScript5, not ES6. – Ringo Mar 24 '17 at 00:33
  • @Del If the CSS is from third-party vendors, just delete the lines. They only affect IE6-. It won't affect anyone if you delete them. – Ringo Mar 24 '17 at 00:39

2 Answers2

1

OK, it seems like you have multiple issues.

Firstly, the way you're building your page is ancient and wrong today.

The "Star HTML" hack you're using was very popular many years ago. It only works in Internet Explorer 6 or OLDER. Info here:

http://www.dynamicsitesolutions.com/css/filters/star-html/

You're also using CSS expressions, which were only supported in Internet Explorer 7 or OLDER. Info here:

Which browsers still support CSS expressions

You should not try to write the code using these old unused technologies -- unless you only want it to work in Internet Explorer 6 or older. Whatever tutorial you're using, it is very outdated. If you really want to use javascript in your css, just write the javascript in a real < script> block instead trying to insert the javascript as a css expression.

Secondly, you have this issue where you're trying to use keyword const. I would like to guess that you actually want to use var instead of const, unless you're intending to use EcmaScript 6. Considering the other issues you're having, I'm guessing either const is a mistake, or you took the line from somewhere and didn't realize it was ES6. I would suggest trying changing const to var first, and if that works for you, then great.

Community
  • 1
  • 1
Ringo
  • 5,097
  • 3
  • 31
  • 46
1

* html would imply that html were the child element of another element - which is impossible: html is always the highest level you can get in HTML/CSS

Johannes
  • 64,305
  • 18
  • 73
  • 130