When I compose JavaScript in BBEdit 9, one of the things I do as I go along
is to use Command-B to see if my tags balance. This normally works fine,
and helps me avoid errors. Another habit of mine is to start with standard
utility functions I find online, and then alter or expand their
functionality for my own use.

I use a getStyles utility function (i.e. get rendered CSS styles of an
element) that I found somewhere online... but ​after a lot of
experimentation with how different browsers report color values, and how
this is affected by CSS3, I added some code to cope with transparent
elements (typically background-color), so that the function will return the
color of the first element ancestor with a real color, rather than
'transparent' which is not useful. The code I added in a couple of lines
requires the following regular expression, which is not nested in anything;
it's just a line inside the overall getStyles function, fairly near the end:

var noCol=/^transparent|rgba.*,\s?0\s?\)$/i;    // Regexp for either the
traditional or the CSS3 way of expressing transparency

This seems to work -- in fact the whole function seems to work OK -- but
when I insert a cursor after the opening curly-brace or before the closing
curly-brace of the function, and then type Command-B, BBEdit just beeps at
me, instead of highlighting the whole body of the function as it normally
would. If I comment out that line, the function tags balance normally, so
obviously that line is preventing BBEdit from seeing how the function's
tags balance. Yet the function seems to work OK and doesn't throw an error.

A complication is that I wrote this regexp a long time ago, and I'm having
a little trouble reading it myself now! I just discovered the balance-tags
issue which is why I'm posting this question now.

Can anybody see what in that code is causing BBEdit not to balance the
overall function? Does it matter? Is there some simple way I could fix that?

Thanks,
Lawrence

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to