cross-browser

XPath queries in IE use zero-based indexes but the W3C spec is one-based. How should I handle the difference?

北城余情 提交于 2019-12-05 08:20:56
The Problem I am converting a relatively large piece of Javascript that currently only works on Internet Explorer in order to make it work on the other browsers as well. Since the code uses XPath extensively we made a little compatibility function to make things easier function selectNodes(xmlDoc, xpath){ if('selectNodes' in xmlDoc){ //use IE logic }else{ //use W3C's document.evaluate } } This is mostly working fine but we just came across the limitation that positions in IE are zero-based but in the W3C model used by the other browsers they are one-based . This means that to get the first

What browsers does AngularJS work with?

有些话、适合烂在心里 提交于 2019-12-05 07:29:14
This can be a most common question. But no any clue about browser versions. More over, Angular site itself says as following. What browsers does Angular work with? We run our extensive test suite against the following browsers: the latest versions of Chrome, Firefox, Safari, and Safari for iOS, as well as Internet Explorer versions 9-11. See Internet Explorer Compatibility for more details on supporting legacy IE browsers. If a browser is untested, it doesn't mean it won't work. You can also expect browsers to work that share a large part of their codebase with a browser we test, such as Opera

Import html fonts and their style variations?

心已入冬 提交于 2019-12-05 07:26:35
I'm implementing google's font named Roboto in my site. I need 2 types : bold and regular . So I checked both types and pressed the download button : But in the downloaded rar file I got ALL the font styles ( also ones which I didn't choose) : Anyway I wanted to test the regular font : ( the fonts are now in my site and not being loaded from google ). (I got those other extensions types (eot,woff,svg) using a font converter ( http://www.font2web.com/ )) So I did : <style type="text/css"> @font-face { font-family: 'Roboto'; src: url('/font-face/Regular/Roboto-Regular.eot'); /* IE9 Compat Modes

IE Compatibility issue: <span> inside <h2>

做~自己de王妃 提交于 2019-12-05 07:08:34
I have the following HTML/CSS, which simply has a <span> tag styled with float:right inside an <h2> tag: <style>h2{background-color:#e2e2e2;} span{float:right;border:1px solid red;}</style> <h2>H2 Test <span>SPAN text</span></h2> Everything works well on Firefox (and I suspect other good browsers, like Chrome, Opera, etc.), but in IE, the <span> gets forced to the next line. Note: the image shows an example of Firefox and IE. How can I get IE to duplicate the behavior of Firefox? Additional info: I am not locked into using float:right , all I really want is a portion of the text left aligned,

How to make my web page display in full in any browser window of any size

时光总嘲笑我的痴心妄想 提交于 2019-12-05 06:29:09
问题 I have made a webpage and this is the code to the main div. #Div { margin-left: 0px; position:absolute; margin-top: -1px; display: inline; float: left; margin-bottom: 0; background-color: #030; width: 660px; margin-left:-330px; left:50%; padding-top: 0px; height: 440px; } Is there a css technique i can use to make sure the page occupies the whole page no matter the size of the computer screen the browser is on. 回答1: Why are you setting margin-left twice? Why are you floating (and displaying

CSS if statements… is it right?

安稳与你 提交于 2019-12-05 06:25:12
I'm new with the conditional CSS. My question is, is it right to use it for dealing with cross-browsers issues? For example: #header { [if IE 7] width: 600px; [if Webkit] width:300px; } Editor's note: OP is most likely using this: http://www.conditional-css.com/ Use conditional statements for the actual CSS files (or classes) but on the html. Like this for example: <!--[if lte IE 6]> <link href="css/layoutIE6.css" rel="stylesheet" type="text/css" /> <![endif]--> This is written on the html file, not the CSS file! The format you posted I think doesn't actually work and I bet it doesn't validate

Detect if browser has smooth scrolling feature already

跟風遠走 提交于 2019-12-05 05:52:33
I have added smooth scrolling to a site of mine using this piece of JavaScript when clicking on hash links. $('a[href*=#]') .click(onAnchorClick); function onAnchorClick(event) { return ! scrollTo(this.hash); } function scrollTo(target) { var e = $(target); var y = e.exists() ? e.offset().top : 0; if(y == 0 && target != '#top') return false; if(Math.max($('html').scrollTop(), $('body').scrollTop()) != y) $('html,body') .animate({scrollTop: y}, 500, function() { location.hash = target; } ); else location.hash = target; return true; } $.fn.exists = function() { return this.length > 0 ? this :

Developing a online exam application, how do I prevent cheaters?

南笙酒味 提交于 2019-12-05 05:34:06
I have the task of developing an online examination software for a small university, I need to implement measures to prevent cheating... What are your ideas on how to do this? I would like to possibly disable all IE / firefox tabs, or some how log internet activity so I know if they are googling anwsers...is there any realistic way to do such things from a flex / web application? Simply put, no there is no realistic way to accomplish this if it is an online exam (assuming they are using their own computers to take the exam). Is opening the browser window full screen an option? You could

Auto-resize SVG inside AngularJS directive based on container element

六月ゝ 毕业季﹏ 提交于 2019-12-05 05:00:47
问题 I am placing an angular directive inside a dynamically-sized element. The directive itself consists of an SVG which is computed based on the element size. I am trying to make the SVG auto-resize and redraw based on the size of the container. I initially tried something like this: my-directive.js angular .module('myModule') .directive('myDirective', function () { return { templateUri: 'path/to/my-directive-template.html', ... }; }); my-directive-template.html <svg style="width: 100%; height:

Cross Browser offsetWidth

帅比萌擦擦* 提交于 2019-12-05 05:00:35
I've been having an issue with using offsetWidth across different browsers. This difference in results is causing some strange layouts. I've created a very small example that displays what I'm seeing. jsbin HTML <table id="tbl"> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> </table> <button onclick="calc()">Calculate Offset Width</button> <div>Cell 1 offsetWidth: <span id="c1offWidth"></span></div> js function calc(){ document.getElementById('c1offWidth').innerHTML = document.getElementById('tbl').children[0].children[0].offsetWidth; } CSS Erik Meyer's Reset CSS When I run this on chrome, safari,