首页 \ 问答 \ 聚合物中的CSS封装限制及其Shadow DOM(CSS Encapsulation Limitations in Polymer and Its Shadow DOM)

聚合物中的CSS封装限制及其Shadow DOM(CSS Encapsulation Limitations in Polymer and Its Shadow DOM)

问题

在使用聚合物项目时,我发现他们在Shadow DOM polyfill上的页面有一组已知的限制http://www.polymer-project.org/platform/shadow-dom.html#known-limitations

列表的第一个限制是:

在此处输入图像描述

研究

在我运行的一些简单测试中,我没有看到任何封装问题。 我有一个jsbin,我一直在测试。 http://jsbin.com/ANeCUv/10/edit

为了测试我从聚合物模板里面的样式标签中删除了那个css import语句。 我注意到,即使在上面标题中的样式标记中仍然调用相同的导入,该元素也变得没有样式。 这至少在这种情况下向我展示了封装阻止了jquery-ui.css为我的元素的Shadow DOM设置样式。

我决定更具体地研究这个问题,并在样式指南http://www.polymer-project.org/articles/styling-elements.html的评论中找到了一些参考文献,例如这个参考文献

在此处输入图像描述

我再次使用旧版本的IE测试,并确认css从元素外部引用的样式中流失。

我理解聚合物及其polyfill的设计,是为了使新的Web技术可访问,并允许旧版本的技术支持不受支持的功能或优雅地进行故障转移。 所以我理解这个问题如何被视为Shadow DOM polyfill的限制。

除了支持旧浏览器的这个问题,我还没有找到其他封装问题。 虽然“CSS封装有限”是一个非常通用的标签,如果唯一已知的限制是与旧浏览器不兼容。

概要

除了旧版浏览器中Shadow DOM polyfill支持的不一致之外,还有CSS Encapsulation的其他已知问题?


Issue

In working with the polymer project I found that their page on their Shadow DOM polyfill had a set of known limitations http://www.polymer-project.org/platform/shadow-dom.html#known-limitations.

The first limitation on the list was :

enter image description here

Research

I hadn't seen any encapsulation issues on some of the simple tests I had run. I have one jsbin, I've kept around to test things. http://jsbin.com/ANeCUv/10/edit .

To test I removed that css import statement from my style tag inside of the polymer template. I noted that the element became unstyled even though the same import was still called in the style tag in the above header. This showed me at least in this case the encapsulation prevented the jquery-ui.css from styling the Shadow DOM of my element.

I decided to research the issue more specifically, and found a few references, like this one in the comments of a styling guide http://www.polymer-project.org/articles/styling-elements.html

enter image description here

I tested again with an older version of IE and confirmed that css was bleeding in from styles referenced outside of the element.

I understand the design of polymer and its polyfills, is to make newer web technologies accessible, and allow unsupported features in older browsers to be supported with older techniques or failover gracefully. So I understand how this issue wold be viewed as a limitation of the Shadow DOM polyfill.

Other than this issue with support for older browsers, I have not been able to find other encapsulation issues. Though the "CSS encapsulation is limited" is a very generic label if the only specific known limitation is incompatibility with older browsers.

Summary

Outside of inconsistencies in the Shadow DOM polyfill support in older browsers are their other known issues with CSS Encapsulation?


原文:https://stackoverflow.com/questions/24806213
更新时间:2022-09-25 09:09

最满意答案

您可以对UITextField使用autocorrectionType

yourTextField.autocorrectionType = UITextAutocorrectionTypeYes;

You can use autocorrectionType for UITextField.

yourTextField.autocorrectionType = UITextAutocorrectionTypeYes;

相关问答

更多
  • UITextField* f = [[UITextField alloc] init]; f.autocorrectionType = UITextAutocorrectionTypeNo; UITextField* f = [[UITextField alloc] init]; f.autocorrectionType = UITextAutocorrectionTypeNo;
  • 通过改变3 - > 0.5,您降低了速度,但也降低了可变性(实际上,使所有速度都相同,因为Math.floor(Math.random() * 0.5)始终为零)。 您可能希望增加第一个值: var speed_rand = 0.5 + Math.random() * 2; ^ ^ min time: 0.5 sec variability: add between 0 and 2 sec By ch ...
  • 你正在使用双引号(“),这会导致你的问题。 删除双引号和自动完成将很容易:) You are using double quotes (") which is causing you problem. Remove double quotes & auto-complete will work easily :)
  • 基于ASKERS FEEDBACK的编辑:我没有意识到你只想在整个文本域中应用一种风格,我认为你想要对各个部分进行设计。 这对你来说更简单,不会给你带来任何麻烦:) var textFormat: TextFormat = new TextFormat("Arial", 12, 0xFF0000); myText.setTextFormat(textFormat); 请注意,这会将样式设置为TextField中的文本,而不一定是您放入的未来文本。因此,在调用setTextFormat之前,请在字段中显示 ...
  • Subclass UITextField and overwrite these methods - (void)awakeFromNib{ CGRect frame = self.leftView.frame; frame.size.width = 30; frame.size.height = 30; self.leftView.frame = frame; self.leftView = [[UIImageView alloc]initWithI ...
  • 是否有某些东西触发某些元素或功能的自动完成开/关? 我刚刚检查过Helio,而且我唯一知道的就是我的头脑,到目前为止,偏好是模板。 您可以使用代码模板触发自动完成并对其进行自定义。 除此之外,我似乎找不到会触发它的php语法列表。 如果你觉得某些元素没有自动完成,那么你可以试试代码模板吗? 您可以尝试将Eclipse中的PHP版本更改为5.3吗? 当我声明类时,代码辅助对我来说只是一种痛苦,我认为它在我声明类之后会做大括号,它没有,它试图在花括号> _>之前添加接口和抽象。 Is there somethi ...
  • 我已经在UITextInput协议的帮助下解决了我的OP问题: - (BOOL)changeRussianCharactersInRange:(NSRange)range replacementString:(NSString *)string { if ([string isEqualToString:@"1"]) { string = @"0"; [self replaceRange:self.selectedTextRange withText: string] ...
  • 使用UITextView要容易得多http://developer.apple.com/library/IOS/#documentation/UIKit/Reference/UITextView_Class/Reference/UITextView.html Use UITextView much easier http://developer.apple.com/library/IOS/#documentation/UIKit/Reference/UITextView_Class/Reference/UI ...
  • 您可以对UITextField使用autocorrectionType 。 yourTextField.autocorrectionType = UITextAutocorrectionTypeYes; You can use autocorrectionType for UITextField. yourTextField.autocorrectionType = UITextAutocorrectionTypeYes;
  • 您可以通过不在表视图中显示所有1k项目来执行此操作,但是当用户开始在文本字段中键入字母时,您可以填充表格视图。 为此,您必须将所有项目放在某些数据结构或数据库中,您可以使用某些排序或查询来获取与用户输入内容相关的项目。 例如,如果用户开始从'a'键入字母,则获取具有字母a的项目并使用它们填充表格。 执行此操作的一种方法是将所有内容放在数据库和UITextField委托中 - (void)textFieldDidBeginEditing:(UITextField *)textField 启动一个NSTime ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)