Comments in actions

  • Hello everyone!

    While i code a lot of actions i need to wirte comments for it, and that's not a problem for defined actions inside <action> xml element, but i encounter unexpected behaviour in event actions.

    For example this event works ok:

    Code
    <events name="skin_events" keep="true"
    	onmouseup="
     	   	// this is comment
     	   	skin_showthumbs(false);
     	   	set(autorotate.waittime, 180);
    	"
    ...
    </events>

    And this doesn't work at all as if it does not exist *smile*

    Code
    <events name="skin_events" keep="true"
    	onmouseup="
     	   	skin_showthumbs(false);
     	   	// this is comment
     	   	set(autorotate.waittime, 180);
    	"
    ...
    </events>

    I don't get any errors or warnings shown in console. So the request is to make comments not influence code wherever they are placed.
    Thanks a lot. *smile*

  • Hi,

    such '//' line comments are officially not supported.

    One reason therefore is that there are no 'lines' anymore after the action parsing. During the parsing all whitespace characters, like spaces, tabs, new-lines were removed. That means the parser could not detect where the line ends.

    But because I'm sometimes internally also was using '//' during testing , there is a still a small support for them - when there is a '//' the current action call will be ignored - one action call always ends with ';'. That means the '//' comment would reach only from '//' to the next ';'.

    But please don't relay on that, I'm considering either removing that ugly internal '//' support or adding real one. In both cases relaying on the current '//' behavior would be problematic. So to avoid problems, just use real xml comments with '<!--' and '-->' as Jordi already has suggested.

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!