Re: [whatwg] self-closing tags in html5

2011-05-14 Thread yuhong



Kornel Lesiński wrote:
 
 Parsing of non-HTML elements is not interoperable between IE and non-IE  
 browsers. IE already supports self-closing syntax on prefixed elements,  
 but other browsers don't:
 
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%3E%0D%0A%3Cfoo%3Abar%2F%3Eaa%0D%0A%3Cfoo%3Abar%3Ebb%3C%2Ffoo%3Abar%3E
 
 and IE cannot properly parse unknown non-prefixed elements, except when  
 (relatively new) workaround is used (http://ejohn.org/blog/html5-shiv):
 
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%3E%0D%0A%3Cfoobar%2F%3Eaa%0D%0A%3Cfoobar%3Ebb%3C%2Ffoobar%3E
 
FYI, the reason is that IE5 supported mixing foreign XML content into HTML
long before HTML5 added this support. It is used for VML for example.
-- 
View this message in context: 
http://old.nabble.com/self-closing-tags-in-html5-tp29813776p31617157.html
Sent from the whatwg.org - whatwg mailing list archive at Nabble.com.



Re: [whatwg] video ... script race condition

2011-05-14 Thread Eric Carlson

On May 13, 2011, at 4:35 AM, Philip Jägenstedt wrote:

 
 I wasn't asking how to work around the problem once you know it exists, I was 
 wondering if any browser vendors have done anything to make this problem less 
 likely to happen on pages like http://html5demos.com/video that don't do the 
 right thing?
 
  WebKit has not.

  It seems to me that the right way to fix the problem is let people know it 
is sloppy code, not to figure out a way to work around it.

eric



Re: [whatwg] Interaction of wbr and CSS white-space

2011-05-14 Thread Jukka K. Korpela

14.5.2011 10:41, Boris Zbarsky wrote:


But why should this [wbr] override CSS that says do not break at any break
opportunities?


I don't think HTML specs should say whether it does; they should just 
specify what wbr means, and in the case of rendering affected by CSS, 
it's up to CSS specs to define the effects of CSS rules. And as far as I 
can see, the current CSS specs don't make it crystal clear what the 
values of white-space mean in each case.


Originally, in CSS 1, white-space affected only whitespace. This was 
changed later, without changing the name of the property, overloading 
the property instead of defining additional properties. Part of the 
confusion has been caused by this. I'm not sure where this all will end, 
and I would prefer letting this be handled in CSS specs.



Oops, my newsreader introduced a line break after a hyphen. And such
behavior is common in web browsers as well. So it is natural to wrap
urls in text in span class=url.../span with CSS rule .url {
white-space: nowrap; }.


Except that browsers don't support that, for the most part.


They mostly support white-space: nowrap well. The part that causes 
problems is that some new versions of browsers support it all too well, 
ignoring wbr markup.



The problem you describe is one of breakpoint prioritization.


I don't think so. I think the primary issue is specifying allowed 
breakpoints. When I wish to say that characters like the hyphen - and 
the percent sign % are not to be treated as breakpoints, as browsers 
may treat them by default, what can I do? As the default treatment of 
characters varies by browser, and the characters in notations like URLs 
vary, there is need for being able to say in this piece of text, 
suppress all breakpoints you might imply, and obey only explicit 
indications of line breaks or line break opportunities.


This is what nobr and wbr were created for, and they were found 
useful and they were widely supported by browsers. Then confusion was 
created, and now that these elements would finally make their way to 
HTML specs, the current wording says that nobr must not be used and 
CSS be used instead. I don't think that's a good idea, but it's 
apparently not a _working_ idea if there is no CSS counterpart.


 I have no

problem with wbr getting priority over breakpoints that the browser
determines itself.


Neither do I, but that's not the point. The point is that wbr should 
be taken as allowed breakpoints even in texts where normal line breaking 
is suppressed.



Anyway, the idea is to disallow line breaks (that would otherwise be
allowed by line breaking rules, whatever they might be in each
situation) _except_ where explicitly allowed by wbr.


This can be done by simply using white-space: normal and having UAs
prioritize breaks at wbr over other linebreaks, no?


No, because browsers treat a large number of non-whitespace characters 
as allowing line breaks after them. Authors need something to prevent 
ridiculous and distorting line breaks in, say, -1, %5, and f(1).



This is needed for example in URLs, where browsers might otherwise
break after - or
% or some other special characters.


For what it's worth, I don't see why this is a problem necessarily. I'll
take you word that it is, but I would appreciate an explanation if
you're willing to provide one.


Breaking a URL after - is particularly confusing and explicitly 
forbidden in many guidelines, including appendix C of RFC 3986 (STD 66). 
Breaking after % in a URL is absurd, as it breaks a %-encoding of a 
character. And problems like this are not limited to URLs.



CSS specs may define a setting that unconditionally prevents line
breaks somewhere


Yes, that's what text-wrap: none means. Right now the HTML spec
explicitly says that this setting should be ignore for wbr, which is
what make no sense.


The statement is in section 13 Rendering, which in non-normative, 
containing suggestions. (I think that's somewhat confusing, as the 
section is clearly meant to be at least semi-normative, and will 
probably be taken as normative.)


And it refers to white-space, not text-wrap. Whether white-space: nowrap 
implies something for text-wrap depends on the definition of CSS, which 
is mutable. I now notice that

http://www.whatwg.org/specs/web-apps/current-work/multipage/references.html#references
contains, under [CSS], a link named
Cascading Style Sheets Level 2 Revision 1
but actually pointing to
http://www.w3.org/TR/CSS/
which is titled
Cascading Style Sheets (CSS) Snapshot 2010
Weird. Anyway, white-space there links to CSS 2.1, and the document 
does not mention text-wrap at all.



The HTML specs cannot dictate what CSS specs do


They're trying to, is my point.


That's unproductive, is my point.

 As an implementor I then have to

reconcile the conflict somehow.


Regarding the current status of CSS, line breaking behavior is 
incompletely defined and partly impractical. But this cannot be fixed 
from the HTML side. The 

Re: [whatwg] video ... script race condition

2011-05-14 Thread Olli Pettay

On 05/15/2011 01:24 AM, Ojan Vafai wrote:


It's unfortunate that you need to use an inline event handler instead of one
registered via addEventListener to avoid the race condition. Exposing
something to the platform like jquery's live event handlers (
http://api.jquery.com/live/) could mitigate this problem in practice, e.g.
it would be just as easy or easier to register the event handler before the
element is created.


There is no need to use inline event handler.
One can always add capturing listener to window for example.
window.addEventListener(canplay,
  function(e) {
if (e.target == document.querySelector('video') {
  // Do something.
}
  }
, true);
And just do that before the video element occurs in the page.
That is simple, IMHO.

jQuery cannot do anything more than that. So if you add the event 
listener using jQuery after the video element, canplay may have

already fired.

(I wonder why the Firing a simple event named e defaults to 
non-bubbling. It makes many things harder than they should be.)



-Olli



Ojan