fixed some of the IE bugs

This commit is contained in:
Misko Hevery 2010-07-23 11:38:52 -07:00
parent 8015e09e38
commit 748e91ba92
4 changed files with 9 additions and 11 deletions

View file

@ -22,7 +22,6 @@ function Browser(location, document, head) {
this.location = location;
this.document = document;
this.body = jqLite(document[0].body);
this.head = head;
this.idCounter = 0;
}

View file

@ -75,8 +75,8 @@ angularService("$log", function($window){
};
}, {inject:['$window']});
angularService("$hover", function(browser) {
var tooltip, self = this, error, width = 300, arrowWidth = 10;
angularService("$hover", function(browser, document) {
var tooltip, self = this, error, width = 300, arrowWidth = 10, body = jqLite(document[0].body);;
browser.hover(function(element, show){
if (show && (error = element.attr(NG_EXCEPTION) || element.attr(NG_VALIDATION_ERROR))) {
if (!tooltip) {
@ -89,9 +89,9 @@ angularService("$hover", function(browser) {
tooltip.callout.append(tooltip.arrow);
tooltip.callout.append(tooltip.title);
tooltip.callout.append(tooltip.content);
self.$browser.body.append(tooltip.callout);
body.append(tooltip.callout);
}
var docRect = self.$browser.body[0].getBoundingClientRect(),
var docRect = body[0].getBoundingClientRect(),
elementRect = element[0].getBoundingClientRect(),
leftSpace = docRect.right - elementRect.right - arrowWidth;
tooltip.title.text(element.hasClass("ng-exception") ? "EXCEPTION:" : "Validation error...");
@ -119,7 +119,7 @@ angularService("$hover", function(browser) {
tooltip = null;
}
});
}, {inject:['$browser']});
}, {inject:['$browser', '$document']});
angularService("$invalidWidgets", function(){
var invalidWidgets = [];

View file

@ -4,7 +4,6 @@ describe('browser', function(){
beforeEach(function(){
location = {href:"http://server", hash:""};
document = jqLite(window.document);
head = {
scripts: [],
append: function(node){head.scripts.push(node);}

View file

@ -1,5 +1,5 @@
describe("service", function(){
var scope, $xhrError, $log;
var scope, $xhrError, $log, mockServices;
beforeEach(function(){
$xhrError = jasmine.createSpy('$xhr.error');
@ -38,7 +38,7 @@ describe("service", function(){
function warn(){ logger+= 'warn;'; };
function info(){ logger+= 'info;'; };
function error(){ logger+= 'error;'; };
var scope = createScope(null, angularService, {$window: {console:{log:log, warn:warn, info:info, error:error}}});
var scope = createScope(null, angularService, {$window: {console:{log:log, warn:warn, info:info, error:error}}, $document:[{}]});
scope.$log.log();
scope.$log.warn();
scope.$log.info();
@ -49,7 +49,7 @@ describe("service", function(){
it('should use console.log if other not present', function(){
var logger = "";
function log(){ logger+= 'log;'; };
var scope = createScope(null, angularService, {$window: {console:{log:log}}});
var scope = createScope(null, angularService, {$window: {console:{log:log}}, $document:[{}]});
scope.$log.log();
scope.$log.warn();
scope.$log.info();
@ -58,7 +58,7 @@ describe("service", function(){
});
it('should use noop if no console', function(){
var scope = createScope(null, angularService, {$window: {}});
var scope = createScope(null, angularService, {$window: {}, $document:[{}]});
scope.$log.log();
scope.$log.warn();
scope.$log.info();