This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Chris/issue 18 #431
Merged
Merged
Chris/issue 18 #431
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ae3c1d7
get selection across the row workgin with negative margins
chrisbank 2eb9680
Merge remote-tracking branch 'origin/master' into chris/issue-18
chrisbank 667f1e1
refactor to use common function
chrisbank b580a53
work on all children
chrisbank 70da2dc
merge from master
chrisbank cc17324
Merge remote-tracking branch 'origin/master' into chris/issue-18
chrisbank 47f44c3
update some merge hickey
chrisbank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2012 Adobe Systems Incorporated. All Rights Reserved. | ||
*/ | ||
|
||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */ | ||
/*global define: false, $: false */ | ||
|
||
define(function (require, exports, module) { | ||
'use strict'; | ||
|
||
// Load dependent modules | ||
|
||
|
||
/** If a parent div has overflow:auto then the child will have a problem | ||
* setting the background color. The reason for this is the width of the | ||
* child is the visible width of the parent and not the scrollWidth, so if | ||
* the div scrolls the background looks wrong. | ||
* @param {!JQuery} $parent the jQuery parent for the object | ||
*/ | ||
function updateChildWidthToParentScrollwidth($parent) { | ||
var $firstChild = $parent.children().first(); | ||
//clear the width first so we get the natural scrollWidth below | ||
$firstChild.width(""); | ||
|
||
var targetWidth = $parent[0].scrollWidth - | ||
parseInt($parent.css("paddingLeft"), 10) - | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if padding is something other than pixels - percentage, ems, etc.? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the $.css() is a wrapper for getComputedStyle which always computes lengths to pixel values |
||
parseInt($parent.css("paddingRight"), 10); | ||
|
||
$firstChild.width(targetWidth); | ||
} | ||
|
||
|
||
// Define public API | ||
exports.updateChildWidthToParentScrollwidth = updateChildWidthToParentScrollwidth; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should either work on all children of the parent, or be passed a child (if you just pass a child, you will need to do an initial pass to clear the child widths first).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do it to all the children