Re: [whatwg] Dirty Property (Was: Markup-related feedback)

Ian Hickson writes:

> On Thu, 10 Jul 2014, Garrett Smith wrote:
> > 
> > 1.  Form `dirty` property. Set to false, initially. Set to true when
> > the user has interacted with any of the form's controls to make them
> > dirty.
> 
> What's the use case?

Situations where I could have used something like this:

• A content management system where the user is previewing their content
  and can either publish it as it is or make further changes and preview
  it again. The ‘Publish’ button needs to check that no changes have
  been made (so that all content gets previewed before publishing).

• An application which involves editing records (such as an address
  book), where closing the page without saving should throw warning that
  the changes will be lost, unless there haven't been any changes.

> Can you work around this by just catching 'input' events on the
> <form>?

Yes.

Though on a form with many fields, a mixture of different types of
controls, it can be tedious to get it right, and I'm not sure if it's
possible to follow the behaviour of some native apps (such as Vim) where
making a change and then pressing ‘undo’ unsets the ‘dirty’ flag.

(Note I'm not arguing that the feature is, on balance, worth including,
merely answering the questions you asked.)

Smylers
-- 
http://twitter.com/Smylers2

Received on Tuesday, 28 October 2014 11:09:17 UTC