properties cannot be attached to plain strings
s = 'foo bar'
s.someProperty = 'test'
s.someProperty
if the string is objectified it works
s = new String('foo bar')
s.someProperty = 'test'
s.someProperty
s.someMethod = function() { return 23 }
s.someMethod()
however through string operations properties are not maintained
s2 = s + 'foo'
s2.someProperty
s.slice(1,3).someProperty
It seems that Strings are not usable for directly storing properties like rich text attributes onto them. Issues that exist:
- String object vs plain string
- strings are not mutable and strings that are the result of string operations do not inherit/get copied properties attached to original strings
- this would mean that we would have to copy all attributes for every text operation and maintain identity.
Our HTML implementation uses the default browser behavior (like typing in text). For many operations this would mean that we would have to switch to manually handling things. Since the current implementation is fast because we do little this would mean that we lose this advantage.