-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MF{type} toString() methods include carriage return #109
Comments
MF{type} toString() is a browser dependent method and not specified. Please do your own formatting, as you like it, manually. For instance you could use:
|
Please note that Titania is now listed on Flathub and Snap Store. All new updates will be from there, the create3000 Flatpak will not longer be updated. Please follow the instructions from http://create3000.de/titania/download/. |
this was found causing problems in an existing world, i am testing for compliance.
AFAIK it is specified for arrays in java/ecmascript to be comma separated. and newlines don't appear to be being generated by the browser (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString ) are you sure this isn't being generated manually by x-ite's js engine? somewhere in the prototype chain directly coded for a 'pretty' print. |
i had been wondering why updates had slowed. |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString describes the JavaScript 'Array' objects method toString. |
i, personally, would see 'toString' as producing 'human readable' text and so would not make assumptions about what it produced, (other than that, when displayed to a human, they would be able to read the value of the object), but i would guess that browsers do generally derive MF*'s from JS Array's and so some people may have unfortunately relied on its formatting. but, here, it was just being used to display a value for a human to read, using the only direct vrml way to do that, through a Text Node. the inclusion of non-printing control characters is what made this stand out as an issue. many other variations in the formatting of the string would not have been an issue. |
An MF* field produces human readable text if you use |
It is no rocket science to get nice one line formatting, for instance you could do:
|
thank you for explaining, again, how easy it is to bypass this issue by modifying the world. i am not making content, this is preexisting (the code in the OP is cut from), and if i were making some it would not be browser dependent.
i had not realised that print() doesn't produce the same string as toString(), for me this goes against a very well established behaviour of js, the use of toString() for default string conversions. it seems to me that this output is more appropriate to toSource(), as this is intended to produce parsable output (machine/human readability) where new lines are expected/handled. |
example
The text was updated successfully, but these errors were encountered: