当设备屏幕大小调整时,我尝试重新排列布局,所以我这样做:
if(screenOrientation == SCREEN_ORIENTATION_LANDSCAPE) {
document.querySelector("html /deep/ [landscape-horizontal]").removeAttribute('vertical');
document.querySelector("html /deep/ [landscape-horizontal]").setAttribute('horizontal', '');
}
这在桌面计算机上正常工作,但在移动设备(Android 手机、平板电脑和 iOS 模拟器)中我收到此错误:
"Uncaught SyntaxError: Failed to execute 'webkitMatchesSelector' on 'Element': 'html /deep/ [landscape-horizontal]' is not a valid selector.", source: bower_components/platform/platform.js (0)
有什么想法吗? 谢谢!
最佳答案
目前有一个open issue在 Shadow DOM polyfill 中支持这一点。它适用于 Chrome 35+,因为它使用 native Shadow dom。
关于javascript - polymer/深度/选择器在移动设备中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24858786/