This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14948 - What should getFlowByName return if there is no flow with the given name?
Summary: What should getFlowByName return if there is no flow with the given name?
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: Regions (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Vincent Hardy
QA Contact:
URL:
Whiteboard: cssom
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-28 15:43 UTC by Vincent Hardy
Modified: 2012-04-11 21:06 UTC (History)
3 users (show)

See Also:


Attachments

Description Vincent Hardy 2011-11-28 15:43:34 UTC
Feedback from Mihnea-Vlad Ovidenie <mihnea@adobe.com> 

===
1. I have a document that does not have a flow thread. From js, I call document.getFlowByName(".."). I assume that this call returns a null object since I do not yet have a flow thread.

2. Another possibility would be to return a valid js object, that, in the future, if the user adds a flowThread with the desired name, gets connected to the flow thread.

Should we support 1 or 2? I would say 1 but the spec does not say anything about the lifetime of the NamedFlow objects.

===
Comment 1 Vincent Hardy 2012-03-13 22:29:01 UTC
So with option 1, we have:

// No flow yet
var nf = document.getFlowByName('article'); // nf is null

// Add content to 'article'
nf = document.getFlowByName('article'); // nf is not null

// Remove all content from 'article'

// nf is now a NamedFlow object that has no content.
nf === document.getFlowByName('article'); // evaluates to false..

Since we can have a named flow with no content, I think I would go with option 2:

// No flow yet
var nf = document.getFlowByName('article'); // nf is not null

// Add content to 'article'
nf === document.getFlowByName('article'); // evaluates to true

// Remove all content from 'article'

// nf is now a NamedFlow object that has no content.
nf === document.getFlowByName('article'); // evaluates to true..
Comment 2 Vincent Hardy 2012-03-22 16:30:58 UTC
(In reply to comment #1)
> So with option 1, we have:
> 
> // No flow yet
> var nf = document.getFlowByName('article'); // nf is null
> 
> // Add content to 'article'
> nf = document.getFlowByName('article'); // nf is not null
> 
> // Remove all content from 'article'
> 
> // nf is now a NamedFlow object that has no content.
> nf === document.getFlowByName('article'); // evaluates to false..
> 
> Since we can have a named flow with no content, I think I would go with option
> 2:
> 
> // No flow yet
> var nf = document.getFlowByName('article'); // nf is not null
> 
> // Add content to 'article'
> nf === document.getFlowByName('article'); // evaluates to true
> 
> // Remove all content from 'article'
> 
> // nf is now a NamedFlow object that has no content.
> nf === document.getFlowByName('article'); // evaluates to true..

After discussion:

Option 1 with the following precisions:

- if a flow has never been referenced by CSS or JS, return null.
- if a flow was previous created, but no longer exists, the implementation may return null.
- if a script holds on to a reference to a NamedFlow, implementations must guarantee that a) the object is valid (can be used) at all times, and b) subsequent calls to getFlowByName with the same name return the same object.
Comment 3 Vincent Hardy 2012-03-27 17:06:15 UTC
Changes for this issue:

https://dvcs.w3.org/hg/csswg/rev/d4e15f801ff5