TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Shadow DOM

276 点作者 madisonmay大约 11 年前

20 条评论

fhd2大约 11 年前
Confusing title. I thought this is about, you know, Shadow DOM (<a href="http://www.w3.org/TR/shadow-dom/" rel="nofollow">http:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;shadow-dom&#x2F;</a>).
评论 #7570337 未加载
nwienert大约 11 年前
At least for the layout issues, I believe with Grid Style Sheets[0] we have a solution. Use it for structure, CSS for &quot;texture&quot;, React for UI and you have yourself a better web stack, today.<p>[0] <a href="http://gridstylesheets.org" rel="nofollow">http:&#x2F;&#x2F;gridstylesheets.org</a>
评论 #7565487 未加载
评论 #7565411 未加载
评论 #7566511 未加载
评论 #7565717 未加载
评论 #7564397 未加载
评论 #7564482 未加载
underwater大约 11 年前
I&#x27;m a bit confused by the potshots taken at React. React is a library for building components. The fact those components render down to DOM nodes is incidental. In fact the documentation[1] hints at other possibilities, like rendering to canvas elements or native iOS views.<p>1: <a href="http://facebook.github.io/react/blog/2013/06/05/why-react.html" rel="nofollow">http:&#x2F;&#x2F;facebook.github.io&#x2F;react&#x2F;blog&#x2F;2013&#x2F;06&#x2F;05&#x2F;why-react.ht...</a>
评论 #7564389 未加载
评论 #7564399 未加载
评论 #7564561 未加载
underwater大约 11 年前
There&#x27;s some good points in here, but they are hidden amongst the rambling text. This could be a much stronger call to action if it weren&#x27;t also a laundry list of the authors pet peeves.<p>Edit: the complaints about needlessly cascading styles and mixed styles defined by properties that are &quot;only meaningful in some combinations&quot; really resonate with me. I&#x27;d love to see him explore this in more depth.
评论 #7564778 未加载
评论 #7565250 未加载
emn13大约 11 年前
The authors complaints - essentially that HTML+CSS are messy and unhandy - resonate with me. Of course, it&#x27;s not surprising these things are crufty - html is ancient, and clearly wasn&#x27;t designed for today&#x27;s world; and the same holds for CSS. But just because the author mentions something that&#x27;s true doesn&#x27;t mean his conclusions make sense. His solutions sound good, but they&#x27;re really superficial and hide mistakes at least as bad as those html+css make today.<p>There are two fundamental ways to improve the dom layout model&#x27;s cruft: By cleaning up weird legacy issues, and by fundamentally changing the way it works (i.e. introducing new layout models, or splitting styling from layout etc.)<p>I think it&#x27;s important to realize that removing cruft is virtually impossible. The cleanliness we seek to simplify our lives in making new things simply isn&#x27;t as valuable as support for old things. Legacy matters; it&#x27;s unhandy, but it&#x27;s also valuable.<p>So let&#x27;s make the realistic assumption that the DOM of today isn&#x27;t going away. You can&#x27;t clean it up; you can only add things that work more easiliy, and perhaps discourage old, confusing behavior. That means thinking about and settling on what this new behavior should be.<p>The author&#x27;s idea of splitting layout from styling simply won&#x27;t work the way he expects it to. He suggests styling text nodes i.e. via `table text` and not have typography related styles on tables themselves. Sounds neat, but this won&#x27;t work with today&#x27;s CSS inheritance rules. If both `table text` and `bold text` were to match, css chooses the more specific (disambiguating by css order) rule. That&#x27;s really not what you wanted to have happen though - just because bold was defined first in css doesn&#x27;t mean it&#x27;s less important. Here, we want specificy in order of DOM ancestry, not selector specificity. In essence, CSS already does the split he imagines - most typography related properties inherit, others generally do not.<p>I&#x27;m not convinced that the OP&#x27;s article really has anything insight worth mentioning. Sure, there&#x27;s lots of legacy, but clearly we can&#x27;t just dump that. Other improvements are possibly, but he doesn&#x27;t make a clear case for any specific, clearly better alternative.
评论 #7567294 未加载
3rd3大约 11 年前
We need the possibility of strict separation of content and presentation and a powerful layout system. Something that removes all the clutter and mind juggling from the current process of developing websites and something that allows for robust wysiwyg editors (like Adobe InDesign).<p>All we want is putting text, shapes and pictures at certain dynamic positions on a screen. That is why I would propose a layout system that is based on positioning guides (straight or curved guide lines or shapes) rather than a box model. It would work like this: Given a set of initial guides which describe the screen shape one can define new guides which depend on the position of other guides. To define a vertical line at the center of the screen one would write: (defgd my-guide (between screen.left screen.right) (h-pos 50%)). Then one could place an object at a position along that line: (defobj my-object (anchor center) (guide my-guide) (pos (&#x2F; (- screen.bottom screen.top) 2)) (content &quot;Hello&quot; (class bold &quot;World!&quot;)) (class headline1) (wrap-at screen.left screen.right) (padding 10px)). Instead of spelling out a content string one could, of course, refer to a variable which is stored in a separate resource. Furthermore, it would be helpful to have something like guide generators which can produce grids or arbitrary other shapes based on a given function (e.g. for tables and positions of other repetitive or self similar page elements).
评论 #7565016 未加载
pjmlp大约 11 年前
And this is why web sucks at UI development and I enjoy doing native UI instead, every time I am allowed to.<p>It should never have gotten further than a document format.<p>Right now it sucks compared to where we could have been with proper UI layout markup and not the actual Frankenstein model of HTML&#x2F;CSS&#x2F;JavaScript, write once debug everywhere.
sgdesign大约 11 年前
Some very convincing points about the flaws of CSS, but I&#x27;m still not sure what a better system would look like, and how realistic implementing that system would be.<p>Maybe the solution will come from new preprocessors (or existing ones like Sass) which will make it possible to write CSS in a completely different way without requiring browser vendors to adapt. Kind of like what CoffeeScript is to JavaScript.
评论 #7564445 未加载
评论 #7579520 未加载
评论 #7564369 未加载
评论 #7564568 未加载
评论 #7564779 未加载
评论 #7567557 未加载
mrec大约 11 年前
I found the title a little unfortunate since &quot;Shadow DOM&quot; already means something specific in this space, namely <a href="http://www.w3.org/TR/shadow-dom/" rel="nofollow">http:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;shadow-dom&#x2F;</a>
Kiro大约 11 年前
&gt; And which is easier: defining a hairy new category of pseudo-elements like :first-letter and :first-line… or just telling people to wrap their first letter in a span if they really want to make it giant?<p>Maybe I misunderstand but I definitely prefer :first-letter than having to wrap it dynamically. I don&#x27;t see why anyone would prefer the latter.
darsham大约 11 年前
I don&#x27;t really agree with this critique. HTML defines the structure and content, CSS defines the style and appearance, and JS defines the behavior. The model is clear and even somewhat elegant.<p>Yes there is overlap, that is inevitable. Yes, you can always make it ugly and there are old vestigial features that you probably shouldn&#x27;t use. These standards have a long, complicated history, but the end result is surprisingly consistent.<p>The different layouts in CSS (inline, block...) are powerful tools once you get used to them. They solve the problem of reconciling different layout models that are useful in different situations. And that&#x27;s one hell of a problem that won&#x27;t go away, even in alternate utopias. In fact most of the complaints here are just about practical solutions to inevitable problems.
whoisthemachine大约 11 年前
I do both native development for windows and web development, and believe me, I&#x27;ll take HTML&#x2F;CSS&#x2F;JS any day. IMO, the box model is extremely conducive to pushing you in the right direction for a clean layout, and maybe CSS is unwieldy because you shouldn&#x27;t be using that many styles; i.e. it was meant to make coming up with a unique style for each button on your site a burden. I did web development as a kid using tables back when that was the way good looking sites were made, and believe me, this model is better, not because of what it enables, but because of what it inhibits.
shadowmint大约 11 年前
Entirely valid complaints.<p>The question is if CSS+HTML+JS can make the leap to convincing near-native-UI somehow (I&#x27;m also dubious, but it&#x27;s possible; something built using canvas and webgl in a manner very much like what pixi.js is currently doing; with all the &#x27;responsiveness&#x27; of a native application, and barely using html&#x2F;css at all seems possible).<p>...or if people will just continue the current trend towards native applications to replace generic multi-platform websites.
评论 #7564679 未加载
_pmf_大约 11 年前
&gt; This is the first example in the MathML spec. Really. &quot;Invisible times&quot;.<p>I thought web developers were all for semantic markup.
Kiro大约 11 年前
I don&#x27;t understand the inline-block critique in &quot;Thinking with Portals&quot;. What exactly is wrong with the Twitter widget?
评论 #7565062 未加载
ben336大约 11 年前
&quot;In reality, most styles don&#x27;t actually cascade&quot; If thats the case, you&#x27;re probably doing something wrong.
frik大约 11 年前
This website is unreadable in Internet Explorer 11 - animated GIF as fullscreen page background.<p>Screenshot: <a href="http://s30.postimg.org/y8tm1yyc1/website_fail.png" rel="nofollow">http:&#x2F;&#x2F;s30.postimg.org&#x2F;y8tm1yyc1&#x2F;website_fail.png</a>
评论 #7565137 未加载
评论 #7565139 未加载
robmcm大约 11 年前
Is he leaning towards just doing everything web app related in a canvas or webGL tag, and leave HTML and CSS to websites.
gress大约 11 年前
In the future, all apps will be built this way.
评论 #7565291 未加载
tech-no-logical大约 11 年前
I guess the site itself avoids the dom by being non-functional in my latest firefox. well done, I say.
评论 #7564731 未加载