Is separation of Content, presentation and behavior possible every time ?

是否每次都可能分离内容、表示和行为?

Many time through javascript we add classes to html and we use in CSS visibility:hidden inline.

很多时候,我们通过javascript向html添加类,并在CSS中使用:隐藏内联。

Should we always invest time to keep all separate?

我们是否应该花时间把一切分开?

4 个解决方案

#1


2

While it is usually possible, it is often not practical. As you say yourself, it costs time. Whether you are willing to invest that time is subject to many factors, of which purism is only one.

虽然它通常是可能的,但它往往不实用。正如你自己所说,这需要时间。你是否愿意投入时间取决于很多因素,而纯粹主义只是其中之一。

In fact, it can be argued (and I've witnessed it being argued first-hand) that since tags such as div or span don't carry any semantical meaning in and on themselves, but have been invented specifically for styling, the moment you use a single one of them on your page, you are already mixing content and presentation. This is a nice philosophical discussion to have, but in business context it leads nowhere.

事实上,它可以认为(我亲眼看到了它被认为),由于标签如div或跨度不携带任何语义意义和在自己身上,但已经发明了专门为样式,当你使用一个其中一个页面上,你已经混合内容和表示。这是一个很好的哲学讨论,但是在商业环境中它却没有任何结果。

So, while you should always try to separate content, presentation and behavior as much as possible, you will always have to stop somewhere, if only to get other things done.

所以,尽管你应该尽可能地把内容、表现和行为分开,但你总要在某个地方停下来,如果只是为了完成其他事情的话。

更多相关文章

  1. 通过AJAX加载内容和预加载图像?
  2. 使用JQuery从外部文件中通过id选择器获取html内容
  3. jQuery autocomplete:如何在结果中选择某些内容后调用getJson?
  4. jQuery 点击div, 向上展示内容
  5. Ajax/jQuery -在页面加载时将网页内容加载到div中?
  6. jQuery append xmlNode 修改 xml 内容
  7. 可编辑的表格:jQuery+PHP实现实时编辑表格字段内容
  8. 使用AJAX和JSON来显示来自PHP的HTML内容。
  9. Google时间轴图表:在“同一”行上多个时,单独为每个栏着色

随机推荐

  1. 系出名门Android(7) - 控件(View)之ZoomC
  2. android activity之间平滑切换
  3. Android开发工具——Android studio1.0正
  4. 让Ubuntu和Android同时运行(Ubuntu on And
  5. Android(安卓)T9搜索
  6. Xamarin Mono Android实现“再按一次退出
  7. 一起学android之EditText的各种使用(15)
  8. Android -- 设置textview文字居中或者控
  9. 在Android模拟器安装应用
  10. Android开发常用代码片段(三)