API for text editing

# Norbert Lindenberg (13 years ago)

API to support text editing applications is an important topic, but I'm afraid it's beyond the scope that TC 39 generally defines for itself. TC 39 primarily defines the ECMAScript language, and then adds some core API that's required in all environments where the language might be used. API related to fonts would likely come well after I/O, which itself isn't on any roadmap I've seen.

A better venue for this proposal might be the W3C, and Boris Zbarsky pointed me at some related work that's already going on there:

  • finding the width of a string

dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface is probably the closest to it... There is also www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-measuretext

It might be worth exposing a text-measurement API independent of canvas, of course.

  • determine cursor position (with bidi support)

dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections

  • detecting whether a glyph is available for a given character

I don't believe there is anything for that right now.

It might be a good idea to define more clearly what's needed and then approach the relevant W3C working group(s), possibly through the Internationalization working group.

Norbert

# Mark Davis ☕ (13 years ago)

I don't see how the W3C could supply an API that would be accessible from Javascript, or am I misunderstanding?

Mark plus.google.com/114199149796022210033 * * — Il meglio è l’inimico del bene — **

# Brendan Eich (13 years ago)

Mark Davis ☕ wrote:

I don't see how the W3C could supply an API that would be accessible from Javascript, or am I misunderstanding?

They do it all the time, using WebIDL. WebIDL has a JS binding that is still being tweaked.

www.w3.org/TR/WebIDL

WebIDL is a Candidate Recommendation, w3-jargon for "ready to implement and test interop". Mozilla is active: we employ the editor, Cameron McCormack, and we're implementing.

The pre-history of WebIDL involves CORBA OMG IDL, and Java as equal to JS in binding language importance, leading to some questionable API design details, but I'll leave it at that.

JS the core language and JS the DOM ("level 0", more or less -- mostly less) originated with me in Netscape 2 in 1995. Why did two standards bodies end up working on these two "JS" aspects? Mostly politics and some division of expert labor flowing from politics of the market powers back then.

# Brendan Eich (13 years ago)

Brendan Eich wrote:

JS the core language and JS the DOM ("level 0", more or less -- mostly less) originated with me in Netscape 2 in 1995. Why did two standards bodies end up working on these two "JS" aspects? Mostly politics and some division of expert labor flowing from politics of the market powers back then.

I should have added, to back up Norbert and Boris on the core-language vs. web-facing (and often browser-not-server-side web-facing, although the browser/server line is getting blurry) division of labor, that anything to-do with glyphs and font widths and editing is pretty squarely not fit for the core-language specifications that Ecma TC39 governs.